aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c1900
1 files changed, 1686 insertions, 214 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 66025161bd69..e72707cb60a3 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -72,6 +72,7 @@ enum {
72enum { 72enum {
73 ALC260_BASIC, 73 ALC260_BASIC,
74 ALC260_HP, 74 ALC260_HP,
75 ALC260_HP_DC7600,
75 ALC260_HP_3013, 76 ALC260_HP_3013,
76 ALC260_FUJITSU_S702X, 77 ALC260_FUJITSU_S702X,
77 ALC260_ACER, 78 ALC260_ACER,
@@ -100,6 +101,9 @@ enum {
100 ALC262_BENQ_T31, 101 ALC262_BENQ_T31,
101 ALC262_ULTRA, 102 ALC262_ULTRA,
102 ALC262_LENOVO_3000, 103 ALC262_LENOVO_3000,
104 ALC262_NEC,
105 ALC262_TOSHIBA_S06,
106 ALC262_TOSHIBA_RX1,
103 ALC262_AUTO, 107 ALC262_AUTO,
104 ALC262_MODEL_LAST /* last tag */ 108 ALC262_MODEL_LAST /* last tag */
105}; 109};
@@ -110,6 +114,7 @@ enum {
110 ALC268_3ST, 114 ALC268_3ST,
111 ALC268_TOSHIBA, 115 ALC268_TOSHIBA,
112 ALC268_ACER, 116 ALC268_ACER,
117 ALC268_ACER_ASPIRE_ONE,
113 ALC268_DELL, 118 ALC268_DELL,
114 ALC268_ZEPTO, 119 ALC268_ZEPTO,
115#ifdef CONFIG_SND_DEBUG 120#ifdef CONFIG_SND_DEBUG
@@ -122,6 +127,7 @@ enum {
122/* ALC269 models */ 127/* ALC269 models */
123enum { 128enum {
124 ALC269_BASIC, 129 ALC269_BASIC,
130 ALC269_QUANTA_FL1,
125 ALC269_ASUS_EEEPC_P703, 131 ALC269_ASUS_EEEPC_P703,
126 ALC269_ASUS_EEEPC_P901, 132 ALC269_ASUS_EEEPC_P901,
127 ALC269_AUTO, 133 ALC269_AUTO,
@@ -169,6 +175,13 @@ enum {
169 ALC663_ASUS_G71V, 175 ALC663_ASUS_G71V,
170 ALC663_ASUS_H13, 176 ALC663_ASUS_H13,
171 ALC663_ASUS_G50V, 177 ALC663_ASUS_G50V,
178 ALC662_ECS,
179 ALC663_ASUS_MODE1,
180 ALC662_ASUS_MODE2,
181 ALC663_ASUS_MODE3,
182 ALC663_ASUS_MODE4,
183 ALC663_ASUS_MODE5,
184 ALC663_ASUS_MODE6,
172 ALC662_AUTO, 185 ALC662_AUTO,
173 ALC662_MODEL_LAST, 186 ALC662_MODEL_LAST,
174}; 187};
@@ -200,18 +213,21 @@ enum {
200 ALC883_ACER, 213 ALC883_ACER,
201 ALC883_ACER_ASPIRE, 214 ALC883_ACER_ASPIRE,
202 ALC883_MEDION, 215 ALC883_MEDION,
203 ALC883_MEDION_MD2, 216 ALC883_MEDION_MD2,
204 ALC883_LAPTOP_EAPD, 217 ALC883_LAPTOP_EAPD,
205 ALC883_LENOVO_101E_2ch, 218 ALC883_LENOVO_101E_2ch,
206 ALC883_LENOVO_NB0763, 219 ALC883_LENOVO_NB0763,
207 ALC888_LENOVO_MS7195_DIG, 220 ALC888_LENOVO_MS7195_DIG,
208 ALC883_HAIER_W66, 221 ALC888_LENOVO_SKY,
222 ALC883_HAIER_W66,
209 ALC888_3ST_HP, 223 ALC888_3ST_HP,
210 ALC888_6ST_DELL, 224 ALC888_6ST_DELL,
211 ALC883_MITAC, 225 ALC883_MITAC,
212 ALC883_CLEVO_M720, 226 ALC883_CLEVO_M720,
213 ALC883_FUJITSU_PI2515, 227 ALC883_FUJITSU_PI2515,
214 ALC883_3ST_6ch_INTEL, 228 ALC883_3ST_6ch_INTEL,
229 ALC888_ASUS_M90V,
230 ALC888_ASUS_EEE1601,
215 ALC883_AUTO, 231 ALC883_AUTO,
216 ALC883_MODEL_LAST, 232 ALC883_MODEL_LAST,
217}; 233};
@@ -398,7 +414,7 @@ static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
398 414
399/* 415/*
400 * Control the mode of pin widget settings via the mixer. "pc" is used 416 * Control the mode of pin widget settings via the mixer. "pc" is used
401 * instead of "%" to avoid consequences of accidently treating the % as 417 * instead of "%" to avoid consequences of accidently treating the % as
402 * being part of a format specifier. Maximum allowed length of a value is 418 * being part of a format specifier. Maximum allowed length of a value is
403 * 63 characters plus NULL terminator. 419 * 63 characters plus NULL terminator.
404 * 420 *
@@ -429,7 +445,7 @@ static unsigned char alc_pin_mode_values[] = {
429#define ALC_PIN_DIR_IN_NOMICBIAS 0x03 445#define ALC_PIN_DIR_IN_NOMICBIAS 0x03
430#define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 446#define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
431 447
432/* Info about the pin modes supported by the different pin direction modes. 448/* Info about the pin modes supported by the different pin direction modes.
433 * For each direction the minimum and maximum values are given. 449 * For each direction the minimum and maximum values are given.
434 */ 450 */
435static signed char alc_pin_mode_dir_info[5][2] = { 451static signed char alc_pin_mode_dir_info[5][2] = {
@@ -502,7 +518,7 @@ static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
502 AC_VERB_SET_PIN_WIDGET_CONTROL, 518 AC_VERB_SET_PIN_WIDGET_CONTROL,
503 alc_pin_mode_values[val]); 519 alc_pin_mode_values[val]);
504 520
505 /* Also enable the retasking pin's input/output as required 521 /* Also enable the retasking pin's input/output as required
506 * for the requested pin mode. Enum values of 2 or less are 522 * for the requested pin mode. Enum values of 2 or less are
507 * input modes. 523 * input modes.
508 * 524 *
@@ -707,7 +723,7 @@ static void setup_preset(struct alc_spec *spec,
707 i++) 723 i++)
708 spec->init_verbs[spec->num_init_verbs++] = 724 spec->init_verbs[spec->num_init_verbs++] =
709 preset->init_verbs[i]; 725 preset->init_verbs[i];
710 726
711 spec->channel_mode = preset->channel_mode; 727 spec->channel_mode = preset->channel_mode;
712 spec->num_channel_mode = preset->num_channel_mode; 728 spec->num_channel_mode = preset->num_channel_mode;
713 spec->need_dac_fix = preset->need_dac_fix; 729 spec->need_dac_fix = preset->need_dac_fix;
@@ -718,7 +734,7 @@ static void setup_preset(struct alc_spec *spec,
718 spec->multiout.dac_nids = preset->dac_nids; 734 spec->multiout.dac_nids = preset->dac_nids;
719 spec->multiout.dig_out_nid = preset->dig_out_nid; 735 spec->multiout.dig_out_nid = preset->dig_out_nid;
720 spec->multiout.hp_nid = preset->hp_nid; 736 spec->multiout.hp_nid = preset->hp_nid;
721 737
722 spec->num_mux_defs = preset->num_mux_defs; 738 spec->num_mux_defs = preset->num_mux_defs;
723 if (!spec->num_mux_defs) 739 if (!spec->num_mux_defs)
724 spec->num_mux_defs = 1; 740 spec->num_mux_defs = 1;
@@ -806,6 +822,27 @@ static void alc_sku_automute(struct hda_codec *codec)
806 spec->jack_present ? 0 : PIN_OUT); 822 spec->jack_present ? 0 : PIN_OUT);
807} 823}
808 824
825static void alc_mic_automute(struct hda_codec *codec)
826{
827 struct alc_spec *spec = codec->spec;
828 unsigned int present;
829 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
830 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
831 unsigned int mix_nid = spec->capsrc_nids[0];
832 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
833
834 capsrc_idx_mic = mic_nid - 0x18;
835 capsrc_idx_fmic = fmic_nid - 0x18;
836 present = snd_hda_codec_read(codec, mic_nid, 0,
837 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
838 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
839 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
840 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
841 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
842 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
843 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
844}
845
809/* unsolicited event for HP jack sensing */ 846/* unsolicited event for HP jack sensing */
810static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) 847static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
811{ 848{
@@ -813,10 +850,17 @@ static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
813 res >>= 28; 850 res >>= 28;
814 else 851 else
815 res >>= 26; 852 res >>= 26;
816 if (res != ALC880_HP_EVENT) 853 if (res == ALC880_HP_EVENT)
817 return; 854 alc_sku_automute(codec);
818 855
856 if (res == ALC880_MIC_EVENT)
857 alc_mic_automute(codec);
858}
859
860static void alc_inithook(struct hda_codec *codec)
861{
819 alc_sku_automute(codec); 862 alc_sku_automute(codec);
863 alc_mic_automute(codec);
820} 864}
821 865
822/* additional initialization for ALC888 variants */ 866/* additional initialization for ALC888 variants */
@@ -855,7 +899,7 @@ static void alc_subsystem_id(struct hda_codec *codec,
855 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) 899 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
856 goto do_sku; 900 goto do_sku;
857 901
858 /* 902 /*
859 * 31~30 : port conetcivity 903 * 31~30 : port conetcivity
860 * 29~21 : reserve 904 * 29~21 : reserve
861 * 20 : PCBEEP input 905 * 20 : PCBEEP input
@@ -946,7 +990,7 @@ do_sku:
946 tmp = snd_hda_codec_read(codec, 0x20, 0, 990 tmp = snd_hda_codec_read(codec, 0x20, 0,
947 AC_VERB_GET_PROC_COEF, 0); 991 AC_VERB_GET_PROC_COEF, 0);
948 snd_hda_codec_write(codec, 0x20, 0, 992 snd_hda_codec_write(codec, 0x20, 0,
949 AC_VERB_SET_COEF_INDEX, 7); 993 AC_VERB_SET_COEF_INDEX, 7);
950 snd_hda_codec_write(codec, 0x20, 0, 994 snd_hda_codec_write(codec, 0x20, 0,
951 AC_VERB_SET_PROC_COEF, 995 AC_VERB_SET_PROC_COEF,
952 tmp | 0x2010); 996 tmp | 0x2010);
@@ -961,7 +1005,7 @@ do_sku:
961 tmp = snd_hda_codec_read(codec, 0x20, 0, 1005 tmp = snd_hda_codec_read(codec, 0x20, 0,
962 AC_VERB_GET_PROC_COEF, 0); 1006 AC_VERB_GET_PROC_COEF, 0);
963 snd_hda_codec_write(codec, 0x20, 0, 1007 snd_hda_codec_write(codec, 0x20, 0,
964 AC_VERB_SET_COEF_INDEX, 7); 1008 AC_VERB_SET_COEF_INDEX, 7);
965 snd_hda_codec_write(codec, 0x20, 0, 1009 snd_hda_codec_write(codec, 0x20, 0,
966 AC_VERB_SET_PROC_COEF, 1010 AC_VERB_SET_PROC_COEF,
967 tmp | 0x3000); 1011 tmp | 0x3000);
@@ -970,7 +1014,7 @@ do_sku:
970 default: 1014 default:
971 break; 1015 break;
972 } 1016 }
973 1017
974 /* is laptop or Desktop and enable the function "Mute internal speaker 1018 /* is laptop or Desktop and enable the function "Mute internal speaker
975 * when the external headphone out jack is plugged" 1019 * when the external headphone out jack is plugged"
976 */ 1020 */
@@ -1002,10 +1046,18 @@ do_sku:
1002 else 1046 else
1003 return; 1047 return;
1004 } 1048 }
1049 if (spec->autocfg.hp_pins[0])
1050 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1051 AC_VERB_SET_UNSOLICITED_ENABLE,
1052 AC_USRSP_EN | ALC880_HP_EVENT);
1053
1054 if (spec->autocfg.input_pins[AUTO_PIN_MIC] &&
1055 spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC])
1056 snd_hda_codec_write(codec,
1057 spec->autocfg.input_pins[AUTO_PIN_MIC], 0,
1058 AC_VERB_SET_UNSOLICITED_ENABLE,
1059 AC_USRSP_EN | ALC880_MIC_EVENT);
1005 1060
1006 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1007 AC_VERB_SET_UNSOLICITED_ENABLE,
1008 AC_USRSP_EN | ALC880_HP_EVENT);
1009 spec->unsol_event = alc_sku_unsol_event; 1061 spec->unsol_event = alc_sku_unsol_event;
1010} 1062}
1011 1063
@@ -1296,7 +1348,7 @@ static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1296 * 1348 *
1297 * The system also has a pair of internal speakers, and a headphone jack. 1349 * The system also has a pair of internal speakers, and a headphone jack.
1298 * These are both connected to Line2 on the codec, hence to DAC 02. 1350 * These are both connected to Line2 on the codec, hence to DAC 02.
1299 * 1351 *
1300 * There is a variable resistor to control the speaker or headphone 1352 * There is a variable resistor to control the speaker or headphone
1301 * volume. This is a hardware-only device without a software API. 1353 * volume. This is a hardware-only device without a software API.
1302 * 1354 *
@@ -1824,7 +1876,7 @@ static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1824 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1876 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1825 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1877 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1826 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1878 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1827 1879
1828 { } 1880 { }
1829}; 1881};
1830 1882
@@ -1869,7 +1921,7 @@ static struct hda_verb alc880_uniwill_init_verbs[] = {
1869 1921
1870/* 1922/*
1871* Uniwill P53 1923* Uniwill P53
1872* HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, 1924* HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1873 */ 1925 */
1874static struct hda_verb alc880_uniwill_p53_init_verbs[] = { 1926static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
1875 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 1927 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
@@ -1968,7 +2020,7 @@ static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
1968static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) 2020static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
1969{ 2021{
1970 unsigned int present; 2022 unsigned int present;
1971 2023
1972 present = snd_hda_codec_read(codec, 0x21, 0, 2024 present = snd_hda_codec_read(codec, 0x21, 0,
1973 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); 2025 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
1974 present &= HDA_AMP_VOLMASK; 2026 present &= HDA_AMP_VOLMASK;
@@ -2050,7 +2102,7 @@ static struct hda_verb alc880_pin_asus_init_verbs[] = {
2050 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 2102 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2051 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 2103 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2052 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 2104 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2053 2105
2054 { } 2106 { }
2055}; 2107};
2056 2108
@@ -2632,12 +2684,14 @@ static int alc_build_pcms(struct hda_codec *codec)
2632 2684
2633 info->name = spec->stream_name_analog; 2685 info->name = spec->stream_name_analog;
2634 if (spec->stream_analog_playback) { 2686 if (spec->stream_analog_playback) {
2635 snd_assert(spec->multiout.dac_nids, return -EINVAL); 2687 if (snd_BUG_ON(!spec->multiout.dac_nids))
2688 return -EINVAL;
2636 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); 2689 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2637 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; 2690 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2638 } 2691 }
2639 if (spec->stream_analog_capture) { 2692 if (spec->stream_analog_capture) {
2640 snd_assert(spec->adc_nids, return -EINVAL); 2693 if (snd_BUG_ON(!spec->adc_nids))
2694 return -EINVAL;
2641 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); 2695 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2642 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; 2696 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2643 } 2697 }
@@ -2667,6 +2721,8 @@ static int alc_build_pcms(struct hda_codec *codec)
2667 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); 2721 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2668 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; 2722 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2669 } 2723 }
2724 /* FIXME: do we need this for all Realtek codec models? */
2725 codec->spdif_status_reset = 1;
2670 } 2726 }
2671 2727
2672 /* If the use of more than one ADC is requested for the current 2728 /* If the use of more than one ADC is requested for the current
@@ -3683,7 +3739,7 @@ static void alc880_auto_init_multi_out(struct hda_codec *codec)
3683{ 3739{
3684 struct alc_spec *spec = codec->spec; 3740 struct alc_spec *spec = codec->spec;
3685 int i; 3741 int i;
3686 3742
3687 alc_subsystem_id(codec, 0x15, 0x1b, 0x14); 3743 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3688 for (i = 0; i < spec->autocfg.line_outs; i++) { 3744 for (i = 0; i < spec->autocfg.line_outs; i++) {
3689 hda_nid_t nid = spec->autocfg.line_out_pins[i]; 3745 hda_nid_t nid = spec->autocfg.line_out_pins[i];
@@ -3787,7 +3843,7 @@ static void alc880_auto_init(struct hda_codec *codec)
3787 alc880_auto_init_extra_out(codec); 3843 alc880_auto_init_extra_out(codec);
3788 alc880_auto_init_analog_input(codec); 3844 alc880_auto_init_analog_input(codec);
3789 if (spec->unsol_event) 3845 if (spec->unsol_event)
3790 alc_sku_automute(codec); 3846 alc_inithook(codec);
3791} 3847}
3792 3848
3793/* 3849/*
@@ -4124,6 +4180,33 @@ static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4124 { } /* end */ 4180 { } /* end */
4125}; 4181};
4126 4182
4183static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4184 .ops = &snd_hda_bind_vol,
4185 .values = {
4186 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4187 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4188 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4189 0
4190 },
4191};
4192
4193static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4194 .ops = &snd_hda_bind_sw,
4195 .values = {
4196 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4197 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4198 0
4199 },
4200};
4201
4202static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4203 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4204 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4205 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4206 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4207 { } /* end */
4208};
4209
4127static struct hda_verb alc260_hp_3013_unsol_verbs[] = { 4210static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4128 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 4211 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4129 {}, 4212 {},
@@ -4147,7 +4230,30 @@ static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4147 alc260_hp_3013_automute(codec); 4230 alc260_hp_3013_automute(codec);
4148} 4231}
4149 4232
4150/* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, 4233static void alc260_hp_3012_automute(struct hda_codec *codec)
4234{
4235 unsigned int present, bits;
4236
4237 present = snd_hda_codec_read(codec, 0x10, 0,
4238 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4239
4240 bits = present ? 0 : PIN_OUT;
4241 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4242 bits);
4243 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4244 bits);
4245 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4246 bits);
4247}
4248
4249static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4250 unsigned int res)
4251{
4252 if ((res >> 26) == ALC880_HP_EVENT)
4253 alc260_hp_3012_automute(codec);
4254}
4255
4256/* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4151 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. 4257 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4152 */ 4258 */
4153static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { 4259static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
@@ -4478,7 +4584,7 @@ static struct hda_verb alc260_fujitsu_init_verbs[] = {
4478 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, 4584 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4479 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, 4585 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4480 4586
4481 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus 4587 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4482 * when acting as an output. 4588 * when acting as an output.
4483 */ 4589 */
4484 {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, 4590 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
@@ -4503,14 +4609,14 @@ static struct hda_verb alc260_fujitsu_init_verbs[] = {
4503 * stage. 4609 * stage.
4504 */ 4610 */
4505 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 4611 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4506 /* Unmute input buffer of pin widget used for Line-in (no equiv 4612 /* Unmute input buffer of pin widget used for Line-in (no equiv
4507 * mixer ctrl) 4613 * mixer ctrl)
4508 */ 4614 */
4509 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4615 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4510 4616
4511 /* Mute capture amp left and right */ 4617 /* Mute capture amp left and right */
4512 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4618 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4513 /* Set ADC connection select to match default mixer setting - line 4619 /* Set ADC connection select to match default mixer setting - line
4514 * in (on mic1 pin) 4620 * in (on mic1 pin)
4515 */ 4621 */
4516 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, 4622 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
@@ -4564,7 +4670,7 @@ static struct hda_verb alc260_acer_init_verbs[] = {
4564 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, 4670 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4565 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, 4671 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4566 4672
4567 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum 4673 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4568 * bus when acting as outputs. 4674 * bus when acting as outputs.
4569 */ 4675 */
4570 {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, 4676 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
@@ -4675,6 +4781,20 @@ static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4675 alc260_replacer_672v_automute(codec); 4781 alc260_replacer_672v_automute(codec);
4676} 4782}
4677 4783
4784static struct hda_verb alc260_hp_dc7600_verbs[] = {
4785 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
4786 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
4787 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4788 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4789 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4790 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4791 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4792 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4793 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4794 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4795 {}
4796};
4797
4678/* Test configuration for debugging, modelled after the ALC880 test 4798/* Test configuration for debugging, modelled after the ALC880 test
4679 * configuration. 4799 * configuration.
4680 */ 4800 */
@@ -4686,7 +4806,7 @@ static hda_nid_t alc260_test_adc_nids[2] = {
4686 0x04, 0x05, 4806 0x04, 0x05,
4687}; 4807};
4688/* For testing the ALC260, each input MUX needs its own definition since 4808/* For testing the ALC260, each input MUX needs its own definition since
4689 * the signal assignments are different. This assumes that the first ADC 4809 * the signal assignments are different. This assumes that the first ADC
4690 * is NID 0x04. 4810 * is NID 0x04.
4691 */ 4811 */
4692static struct hda_input_mux alc260_test_capture_sources[2] = { 4812static struct hda_input_mux alc260_test_capture_sources[2] = {
@@ -4769,7 +4889,7 @@ static struct snd_kcontrol_new alc260_test_mixer[] = {
4769 4889
4770 /* Switches to allow the digital IO pins to be enabled. The datasheet 4890 /* Switches to allow the digital IO pins to be enabled. The datasheet
4771 * is ambigious as to which NID is which; testing on laptops which 4891 * is ambigious as to which NID is which; testing on laptops which
4772 * make this output available should provide clarification. 4892 * make this output available should provide clarification.
4773 */ 4893 */
4774 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), 4894 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4775 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), 4895 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
@@ -4805,7 +4925,7 @@ static struct hda_verb alc260_test_init_verbs[] = {
4805 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, 4925 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4806 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, 4926 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4807 4927
4808 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the 4928 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4809 * OUT1 sum bus when acting as an output. 4929 * OUT1 sum bus when acting as an output.
4810 */ 4930 */
4811 {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, 4931 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
@@ -4897,7 +5017,7 @@ static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
4897 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); 5017 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4898 } else 5018 } else
4899 return 0; /* N/A */ 5019 return 0; /* N/A */
4900 5020
4901 snprintf(name, sizeof(name), "%s Playback Volume", pfx); 5021 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
4902 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); 5022 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
4903 if (err < 0) 5023 if (err < 0)
@@ -5003,7 +5123,7 @@ static void alc260_auto_init_multi_out(struct hda_codec *codec)
5003 int pin_type = get_pin_type(spec->autocfg.line_out_type); 5123 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5004 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); 5124 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5005 } 5125 }
5006 5126
5007 nid = spec->autocfg.speaker_pins[0]; 5127 nid = spec->autocfg.speaker_pins[0];
5008 if (nid) 5128 if (nid)
5009 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); 5129 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
@@ -5045,7 +5165,7 @@ static struct hda_verb alc260_volume_init_verbs[] = {
5045 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5165 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5046 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, 5166 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5047 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5167 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5048 5168
5049 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback 5169 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5050 * mixer widget 5170 * mixer widget
5051 * Note: PASD motherboards uses the Line In 2 as the input for 5171 * Note: PASD motherboards uses the Line In 2 as the input for
@@ -5074,7 +5194,7 @@ static struct hda_verb alc260_volume_init_verbs[] = {
5074 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5194 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5075 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5195 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5076 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5196 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5077 5197
5078 { } 5198 { }
5079}; 5199};
5080 5200
@@ -5134,7 +5254,7 @@ static void alc260_auto_init(struct hda_codec *codec)
5134 alc260_auto_init_multi_out(codec); 5254 alc260_auto_init_multi_out(codec);
5135 alc260_auto_init_analog_input(codec); 5255 alc260_auto_init_analog_input(codec);
5136 if (spec->unsol_event) 5256 if (spec->unsol_event)
5137 alc_sku_automute(codec); 5257 alc_inithook(codec);
5138} 5258}
5139 5259
5140#ifdef CONFIG_SND_HDA_POWER_SAVE 5260#ifdef CONFIG_SND_HDA_POWER_SAVE
@@ -5155,6 +5275,7 @@ static const char *alc260_models[ALC260_MODEL_LAST] = {
5155 [ALC260_BASIC] = "basic", 5275 [ALC260_BASIC] = "basic",
5156 [ALC260_HP] = "hp", 5276 [ALC260_HP] = "hp",
5157 [ALC260_HP_3013] = "hp-3013", 5277 [ALC260_HP_3013] = "hp-3013",
5278 [ALC260_HP_DC7600] = "hp-dc7600",
5158 [ALC260_FUJITSU_S702X] = "fujitsu", 5279 [ALC260_FUJITSU_S702X] = "fujitsu",
5159 [ALC260_ACER] = "acer", 5280 [ALC260_ACER] = "acer",
5160 [ALC260_WILL] = "will", 5281 [ALC260_WILL] = "will",
@@ -5172,7 +5293,7 @@ static struct snd_pci_quirk alc260_cfg_tbl[] = {
5172 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), 5293 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5173 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), 5294 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5174 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), 5295 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5175 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), 5296 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5176 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), 5297 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5177 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), 5298 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5178 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), 5299 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
@@ -5218,6 +5339,22 @@ static struct alc_config_preset alc260_presets[] = {
5218 .unsol_event = alc260_hp_unsol_event, 5339 .unsol_event = alc260_hp_unsol_event,
5219 .init_hook = alc260_hp_automute, 5340 .init_hook = alc260_hp_automute,
5220 }, 5341 },
5342 [ALC260_HP_DC7600] = {
5343 .mixers = { alc260_hp_dc7600_mixer,
5344 alc260_input_mixer,
5345 alc260_capture_alt_mixer },
5346 .init_verbs = { alc260_init_verbs,
5347 alc260_hp_dc7600_verbs },
5348 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5349 .dac_nids = alc260_dac_nids,
5350 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5351 .adc_nids = alc260_hp_adc_nids,
5352 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5353 .channel_mode = alc260_modes,
5354 .input_mux = &alc260_capture_source,
5355 .unsol_event = alc260_hp_3012_unsol_event,
5356 .init_hook = alc260_hp_3012_automute,
5357 },
5221 [ALC260_HP_3013] = { 5358 [ALC260_HP_3013] = {
5222 .mixers = { alc260_hp_3013_mixer, 5359 .mixers = { alc260_hp_3013_mixer,
5223 alc260_input_mixer, 5360 alc260_input_mixer,
@@ -5933,7 +6070,7 @@ static struct hda_verb alc882_targa_verbs[] = {
5933 6070
5934 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 6071 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5935 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 6072 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5936 6073
5937 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ 6074 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5938 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ 6075 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5939 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 6076 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
@@ -5949,7 +6086,7 @@ static struct hda_verb alc882_targa_verbs[] = {
5949static void alc882_targa_automute(struct hda_codec *codec) 6086static void alc882_targa_automute(struct hda_codec *codec)
5950{ 6087{
5951 unsigned int present; 6088 unsigned int present;
5952 6089
5953 present = snd_hda_codec_read(codec, 0x14, 0, 6090 present = snd_hda_codec_read(codec, 0x14, 0,
5954 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 6091 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5955 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, 6092 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
@@ -5975,7 +6112,7 @@ static struct hda_verb alc882_asus_a7j_verbs[] = {
5975 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 6112 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5976 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 6113 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5977 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 6114 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5978 6115
5979 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ 6116 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5980 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 6117 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5981 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ 6118 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
@@ -5993,7 +6130,7 @@ static struct hda_verb alc882_asus_a7m_verbs[] = {
5993 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 6130 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5994 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 6131 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5995 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 6132 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5996 6133
5997 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ 6134 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5998 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 6135 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5999 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ 6136 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
@@ -6319,7 +6456,7 @@ static struct alc_config_preset alc882_presets[] = {
6319 .channel_mode = alc882_3ST_6ch_modes, 6456 .channel_mode = alc882_3ST_6ch_modes,
6320 .need_dac_fix = 1, 6457 .need_dac_fix = 1,
6321 .input_mux = &alc882_capture_source, 6458 .input_mux = &alc882_capture_source,
6322 }, 6459 },
6323 [ALC882_ASUS_A7M] = { 6460 [ALC882_ASUS_A7M] = {
6324 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, 6461 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6325 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, 6462 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
@@ -6332,14 +6469,14 @@ static struct alc_config_preset alc882_presets[] = {
6332 .channel_mode = alc880_threestack_modes, 6469 .channel_mode = alc880_threestack_modes,
6333 .need_dac_fix = 1, 6470 .need_dac_fix = 1,
6334 .input_mux = &alc882_capture_source, 6471 .input_mux = &alc882_capture_source,
6335 }, 6472 },
6336}; 6473};
6337 6474
6338 6475
6339/* 6476/*
6340 * Pin config fixes 6477 * Pin config fixes
6341 */ 6478 */
6342enum { 6479enum {
6343 PINFIX_ABIT_AW9D_MAX 6480 PINFIX_ABIT_AW9D_MAX
6344}; 6481};
6345 6482
@@ -6527,7 +6664,7 @@ static void alc882_auto_init(struct hda_codec *codec)
6527 alc882_auto_init_analog_input(codec); 6664 alc882_auto_init_analog_input(codec);
6528 alc882_auto_init_input_src(codec); 6665 alc882_auto_init_input_src(codec);
6529 if (spec->unsol_event) 6666 if (spec->unsol_event)
6530 alc_sku_automute(codec); 6667 alc_inithook(codec);
6531} 6668}
6532 6669
6533static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ 6670static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
@@ -6554,16 +6691,19 @@ static int patch_alc882(struct hda_codec *codec)
6554 board_config = ALC885_MACPRO; 6691 board_config = ALC885_MACPRO;
6555 break; 6692 break;
6556 case 0x106b1000: /* iMac 24 */ 6693 case 0x106b1000: /* iMac 24 */
6694 case 0x106b2800: /* AppleTV */
6557 board_config = ALC885_IMAC24; 6695 board_config = ALC885_IMAC24;
6558 break; 6696 break;
6559 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ 6697 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
6698 case 0x106b00a4: /* MacbookPro4,1 */
6560 case 0x106b2c00: /* Macbook Pro rev3 */ 6699 case 0x106b2c00: /* Macbook Pro rev3 */
6561 case 0x106b3600: /* Macbook 3.1 */ 6700 case 0x106b3600: /* Macbook 3.1 */
6562 board_config = ALC885_MBP3; 6701 board_config = ALC885_MBP3;
6563 break; 6702 break;
6564 default: 6703 default:
6565 /* ALC889A is handled better as ALC888-compatible */ 6704 /* ALC889A is handled better as ALC888-compatible */
6566 if (codec->revision_id == 0x100103) { 6705 if (codec->revision_id == 0x100101 ||
6706 codec->revision_id == 0x100103) {
6567 alc_free(codec); 6707 alc_free(codec);
6568 return patch_alc883(codec); 6708 return patch_alc883(codec);
6569 } 6709 }
@@ -6718,6 +6858,23 @@ static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6718 }, 6858 },
6719}; 6859};
6720 6860
6861static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6862 .num_items = 3,
6863 .items = {
6864 { "Mic", 0x0 },
6865 { "Front Mic", 0x1 },
6866 { "Line", 0x4 },
6867 },
6868};
6869
6870static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6871 .num_items = 2,
6872 .items = {
6873 { "Mic", 0x0 },
6874 { "Line", 0x2 },
6875 },
6876};
6877
6721#define alc883_mux_enum_info alc_mux_enum_info 6878#define alc883_mux_enum_info alc_mux_enum_info
6722#define alc883_mux_enum_get alc_mux_enum_get 6879#define alc883_mux_enum_get alc_mux_enum_get
6723/* ALC883 has the ALC882-type input selection */ 6880/* ALC883 has the ALC882-type input selection */
@@ -7032,13 +7189,11 @@ static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7032 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), 7189 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7033 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 7190 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7034 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 7191 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7035 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7036 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7037 { 7192 {
7038 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 7193 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7039 /* .name = "Capture Source", */ 7194 /* .name = "Capture Source", */
7040 .name = "Input Source", 7195 .name = "Input Source",
7041 .count = 2, 7196 .count = 1,
7042 .info = alc883_mux_enum_info, 7197 .info = alc883_mux_enum_info,
7043 .get = alc883_mux_enum_get, 7198 .get = alc883_mux_enum_get,
7044 .put = alc883_mux_enum_put, 7199 .put = alc883_mux_enum_put,
@@ -7256,7 +7411,7 @@ static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7256 .put = alc883_mux_enum_put, 7411 .put = alc883_mux_enum_put,
7257 }, 7412 },
7258 { } /* end */ 7413 { } /* end */
7259}; 7414};
7260 7415
7261static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { 7416static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7262 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 7417 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
@@ -7283,6 +7438,87 @@ static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7283 { } /* end */ 7438 { } /* end */
7284}; 7439};
7285 7440
7441static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7442 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7443 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7444 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7445 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7446 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7447 0x0d, 1, 0x0, HDA_OUTPUT),
7448 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7449 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7450 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7451 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7452 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7453 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7454 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7455 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7456 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7457 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7458 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7459 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7460 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7461 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7462 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7463 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7464 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7465 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7466 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7467 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7468 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7469 {
7470 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7471 /* .name = "Capture Source", */
7472 .name = "Input Source",
7473 .count = 2,
7474 .info = alc883_mux_enum_info,
7475 .get = alc883_mux_enum_get,
7476 .put = alc883_mux_enum_put,
7477 },
7478 { } /* end */
7479};
7480
7481static struct hda_bind_ctls alc883_bind_cap_vol = {
7482 .ops = &snd_hda_bind_vol,
7483 .values = {
7484 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7485 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7486 0
7487 },
7488};
7489
7490static struct hda_bind_ctls alc883_bind_cap_switch = {
7491 .ops = &snd_hda_bind_sw,
7492 .values = {
7493 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7494 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7495 0
7496 },
7497};
7498
7499static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7500 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7501 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7502 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7503 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7504 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7505 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7506 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7507 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7508 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7509 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7510 {
7511 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7512 /* .name = "Capture Source", */
7513 .name = "Input Source",
7514 .count = 1,
7515 .info = alc883_mux_enum_info,
7516 .get = alc883_mux_enum_get,
7517 .put = alc883_mux_enum_put,
7518 },
7519 { } /* end */
7520};
7521
7286static struct snd_kcontrol_new alc883_chmode_mixer[] = { 7522static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7287 { 7523 {
7288 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 7524 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -7296,7 +7532,7 @@ static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7296 7532
7297static struct hda_verb alc883_init_verbs[] = { 7533static struct hda_verb alc883_init_verbs[] = {
7298 /* ADC1: mute amp left and right */ 7534 /* ADC1: mute amp left and right */
7299 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 7535 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7300 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 7536 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7301 /* ADC2: mute amp left and right */ 7537 /* ADC2: mute amp left and right */
7302 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 7538 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
@@ -7361,14 +7597,14 @@ static struct hda_verb alc883_init_verbs[] = {
7361 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ 7597 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7362 /* Input mixer2 */ 7598 /* Input mixer2 */
7363 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7599 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7364 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7600 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7365 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 7601 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7366 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, 7602 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7367 /* Input mixer3 */ 7603 /* Input mixer3 */
7368 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7604 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7369 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7605 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7370 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 7606 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7371 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, 7607 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7372 { } 7608 { }
7373}; 7609};
7374 7610
@@ -7468,7 +7704,7 @@ static struct hda_verb alc883_tagra_verbs[] = {
7468 7704
7469 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 7705 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7470 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 7706 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7471 7707
7472 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ 7708 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7473 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ 7709 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7474 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 7710 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
@@ -7518,6 +7754,18 @@ static struct hda_verb alc883_haier_w66_verbs[] = {
7518 { } /* end */ 7754 { } /* end */
7519}; 7755};
7520 7756
7757static struct hda_verb alc888_lenovo_sky_verbs[] = {
7758 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7759 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7760 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7761 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7762 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7763 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7764 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7765 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7766 { } /* end */
7767};
7768
7521static struct hda_verb alc888_3st_hp_verbs[] = { 7769static struct hda_verb alc888_3st_hp_verbs[] = {
7522 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ 7770 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7523 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ 7771 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
@@ -7555,7 +7803,7 @@ static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7555static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) 7803static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7556{ 7804{
7557 unsigned int present; 7805 unsigned int present;
7558 7806
7559 present = snd_hda_codec_read(codec, 0x1b, 0, 7807 present = snd_hda_codec_read(codec, 0x1b, 0,
7560 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 7808 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7561 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 7809 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
@@ -7568,7 +7816,7 @@ static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7568static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) 7816static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7569{ 7817{
7570 unsigned int present; 7818 unsigned int present;
7571 7819
7572 present = snd_hda_codec_read(codec, 0x14, 0, 7820 present = snd_hda_codec_read(codec, 0x14, 0,
7573 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 7821 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7574 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, 7822 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
@@ -7598,7 +7846,7 @@ static struct hda_verb alc883_medion_md2_verbs[] = {
7598static void alc883_medion_md2_automute(struct hda_codec *codec) 7846static void alc883_medion_md2_automute(struct hda_codec *codec)
7599{ 7847{
7600 unsigned int present; 7848 unsigned int present;
7601 7849
7602 present = snd_hda_codec_read(codec, 0x14, 0, 7850 present = snd_hda_codec_read(codec, 0x14, 0,
7603 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 7851 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7604 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, 7852 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
@@ -7753,7 +8001,7 @@ static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
7753static void alc883_acer_aspire_automute(struct hda_codec *codec) 8001static void alc883_acer_aspire_automute(struct hda_codec *codec)
7754{ 8002{
7755 unsigned int present; 8003 unsigned int present;
7756 8004
7757 present = snd_hda_codec_read(codec, 0x14, 0, 8005 present = snd_hda_codec_read(codec, 0x14, 0,
7758 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 8006 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7759 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, 8007 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
@@ -7790,7 +8038,7 @@ static struct hda_verb alc883_acer_eapd_verbs[] = {
7790static void alc888_6st_dell_front_automute(struct hda_codec *codec) 8038static void alc888_6st_dell_front_automute(struct hda_codec *codec)
7791{ 8039{
7792 unsigned int present; 8040 unsigned int present;
7793 8041
7794 present = snd_hda_codec_read(codec, 0x1b, 0, 8042 present = snd_hda_codec_read(codec, 0x1b, 0,
7795 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 8043 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7796 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 8044 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
@@ -7814,6 +8062,50 @@ static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
7814 } 8062 }
7815} 8063}
7816 8064
8065static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
8066{
8067 unsigned int mute;
8068 unsigned int present;
8069
8070 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8071 present = snd_hda_codec_read(codec, 0x1b, 0,
8072 AC_VERB_GET_PIN_SENSE, 0);
8073 present = (present & 0x80000000) != 0;
8074 if (present) {
8075 /* mute internal speaker */
8076 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8077 HDA_AMP_MUTE, HDA_AMP_MUTE);
8078 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8079 HDA_AMP_MUTE, HDA_AMP_MUTE);
8080 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8081 HDA_AMP_MUTE, HDA_AMP_MUTE);
8082 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8083 HDA_AMP_MUTE, HDA_AMP_MUTE);
8084 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8085 HDA_AMP_MUTE, HDA_AMP_MUTE);
8086 } else {
8087 /* unmute internal speaker if necessary */
8088 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8089 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8090 HDA_AMP_MUTE, mute);
8091 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8092 HDA_AMP_MUTE, mute);
8093 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8094 HDA_AMP_MUTE, mute);
8095 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8096 HDA_AMP_MUTE, mute);
8097 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8098 HDA_AMP_MUTE, mute);
8099 }
8100}
8101
8102static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
8103 unsigned int res)
8104{
8105 if ((res >> 26) == ALC880_HP_EVENT)
8106 alc888_lenovo_sky_front_automute(codec);
8107}
8108
7817/* 8109/*
7818 * generic initialization of ADC, input mixers and output mixers 8110 * generic initialization of ADC, input mixers and output mixers
7819 */ 8111 */
@@ -7898,6 +8190,105 @@ static struct snd_kcontrol_new alc883_capture_mixer[] = {
7898 { } /* end */ 8190 { } /* end */
7899}; 8191};
7900 8192
8193static struct hda_verb alc888_asus_m90v_verbs[] = {
8194 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8195 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8196 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8197 /* enable unsolicited event */
8198 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8199 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8200 { } /* end */
8201};
8202
8203static void alc883_nb_mic_automute(struct hda_codec *codec)
8204{
8205 unsigned int present;
8206
8207 present = snd_hda_codec_read(codec, 0x18, 0,
8208 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8209 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8210 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8211 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8212 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8213}
8214
8215static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8216{
8217 unsigned int present;
8218 unsigned char bits;
8219
8220 present = snd_hda_codec_read(codec, 0x1b, 0,
8221 AC_VERB_GET_PIN_SENSE, 0)
8222 & AC_PINSENSE_PRESENCE;
8223 bits = present ? 0 : PIN_OUT;
8224 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8225 bits);
8226 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8227 bits);
8228 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8229 bits);
8230}
8231
8232static void alc883_mode2_unsol_event(struct hda_codec *codec,
8233 unsigned int res)
8234{
8235 switch (res >> 26) {
8236 case ALC880_HP_EVENT:
8237 alc883_M90V_speaker_automute(codec);
8238 break;
8239 case ALC880_MIC_EVENT:
8240 alc883_nb_mic_automute(codec);
8241 break;
8242 }
8243}
8244
8245static void alc883_mode2_inithook(struct hda_codec *codec)
8246{
8247 alc883_M90V_speaker_automute(codec);
8248 alc883_nb_mic_automute(codec);
8249}
8250
8251static struct hda_verb alc888_asus_eee1601_verbs[] = {
8252 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8253 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8254 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8255 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8256 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8257 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8258 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8259 /* enable unsolicited event */
8260 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8261 { } /* end */
8262};
8263
8264static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8265{
8266 unsigned int present;
8267 unsigned char bits;
8268
8269 present = snd_hda_codec_read(codec, 0x14, 0,
8270 AC_VERB_GET_PIN_SENSE, 0)
8271 & AC_PINSENSE_PRESENCE;
8272 bits = present ? 0 : PIN_OUT;
8273 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8274 bits);
8275}
8276
8277static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8278 unsigned int res)
8279{
8280 switch (res >> 26) {
8281 case ALC880_HP_EVENT:
8282 alc883_eee1601_speaker_automute(codec);
8283 break;
8284 }
8285}
8286
8287static void alc883_eee1601_inithook(struct hda_codec *codec)
8288{
8289 alc883_eee1601_speaker_automute(codec);
8290}
8291
7901#ifdef CONFIG_SND_HDA_POWER_SAVE 8292#ifdef CONFIG_SND_HDA_POWER_SAVE
7902#define alc883_loopbacks alc880_loopbacks 8293#define alc883_loopbacks alc880_loopbacks
7903#endif 8294#endif
@@ -7927,6 +8318,7 @@ static const char *alc883_models[ALC883_MODEL_LAST] = {
7927 [ALC883_LENOVO_101E_2ch] = "lenovo-101e", 8318 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
7928 [ALC883_LENOVO_NB0763] = "lenovo-nb0763", 8319 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
7929 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", 8320 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8321 [ALC888_LENOVO_SKY] = "lenovo-sky",
7930 [ALC883_HAIER_W66] = "haier-w66", 8322 [ALC883_HAIER_W66] = "haier-w66",
7931 [ALC888_3ST_HP] = "3stack-hp", 8323 [ALC888_3ST_HP] = "3stack-hp",
7932 [ALC888_6ST_DELL] = "6stack-dell", 8324 [ALC888_6ST_DELL] = "6stack-dell",
@@ -7942,18 +8334,21 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
7942 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), 8334 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
7943 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), 8335 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
7944 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), 8336 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
7945 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), 8337 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
7946 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ 8338 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
7947 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), 8339 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
7948 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), 8340 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
7949 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), 8341 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
7950 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), 8342 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
7951 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), 8343 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8344 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
7952 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), 8345 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8346 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
7953 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), 8347 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
7954 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), 8348 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
7955 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), 8349 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
7956 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), 8350 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8351 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
7957 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), 8352 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
7958 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), 8353 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
7959 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), 8354 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
@@ -7989,6 +8384,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
7989 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), 8384 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7990 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), 8385 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7991 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), 8386 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8387 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
7992 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), 8388 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
7993 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), 8389 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
7994 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), 8390 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
@@ -8128,7 +8524,7 @@ static struct alc_config_preset alc883_presets[] = {
8128 .input_mux = &alc883_capture_source, 8524 .input_mux = &alc883_capture_source,
8129 .unsol_event = alc883_medion_md2_unsol_event, 8525 .unsol_event = alc883_medion_md2_unsol_event,
8130 .init_hook = alc883_medion_md2_automute, 8526 .init_hook = alc883_medion_md2_automute,
8131 }, 8527 },
8132 [ALC883_LAPTOP_EAPD] = { 8528 [ALC883_LAPTOP_EAPD] = {
8133 .mixers = { alc883_base_mixer }, 8529 .mixers = { alc883_base_mixer },
8134 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, 8530 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
@@ -8245,6 +8641,49 @@ static struct alc_config_preset alc883_presets[] = {
8245 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, 8641 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8246 .init_hook = alc883_2ch_fujitsu_pi2515_automute, 8642 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8247 }, 8643 },
8644 [ALC888_LENOVO_SKY] = {
8645 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
8646 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
8647 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8648 .dac_nids = alc883_dac_nids,
8649 .dig_out_nid = ALC883_DIGOUT_NID,
8650 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
8651 .adc_nids = alc883_adc_nids,
8652 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8653 .channel_mode = alc883_sixstack_modes,
8654 .need_dac_fix = 1,
8655 .input_mux = &alc883_lenovo_sky_capture_source,
8656 .unsol_event = alc883_lenovo_sky_unsol_event,
8657 .init_hook = alc888_lenovo_sky_front_automute,
8658 },
8659 [ALC888_ASUS_M90V] = {
8660 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8661 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
8662 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8663 .dac_nids = alc883_dac_nids,
8664 .dig_out_nid = ALC883_DIGOUT_NID,
8665 .dig_in_nid = ALC883_DIGIN_NID,
8666 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8667 .channel_mode = alc883_3ST_6ch_modes,
8668 .need_dac_fix = 1,
8669 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8670 .unsol_event = alc883_mode2_unsol_event,
8671 .init_hook = alc883_mode2_inithook,
8672 },
8673 [ALC888_ASUS_EEE1601] = {
8674 .mixers = { alc883_asus_eee1601_mixer },
8675 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
8676 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8677 .dac_nids = alc883_dac_nids,
8678 .dig_out_nid = ALC883_DIGOUT_NID,
8679 .dig_in_nid = ALC883_DIGIN_NID,
8680 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8681 .channel_mode = alc883_3ST_2ch_modes,
8682 .need_dac_fix = 1,
8683 .input_mux = &alc883_asus_eee1601_capture_source,
8684 .unsol_event = alc883_eee1601_unsol_event,
8685 .init_hook = alc883_eee1601_inithook,
8686 },
8248}; 8687};
8249 8688
8250 8689
@@ -8354,7 +8793,7 @@ static void alc883_auto_init(struct hda_codec *codec)
8354 alc883_auto_init_analog_input(codec); 8793 alc883_auto_init_analog_input(codec);
8355 alc883_auto_init_input_src(codec); 8794 alc883_auto_init_input_src(codec);
8356 if (spec->unsol_event) 8795 if (spec->unsol_event)
8357 alc_sku_automute(codec); 8796 alc_inithook(codec);
8358} 8797}
8359 8798
8360static int patch_alc883(struct hda_codec *codec) 8799static int patch_alc883(struct hda_codec *codec)
@@ -8398,8 +8837,13 @@ static int patch_alc883(struct hda_codec *codec)
8398 8837
8399 switch (codec->vendor_id) { 8838 switch (codec->vendor_id) {
8400 case 0x10ec0888: 8839 case 0x10ec0888:
8401 spec->stream_name_analog = "ALC888 Analog"; 8840 if (codec->revision_id == 0x100101) {
8402 spec->stream_name_digital = "ALC888 Digital"; 8841 spec->stream_name_analog = "ALC1200 Analog";
8842 spec->stream_name_digital = "ALC1200 Digital";
8843 } else {
8844 spec->stream_name_analog = "ALC888 Analog";
8845 spec->stream_name_digital = "ALC888 Digital";
8846 }
8403 break; 8847 break;
8404 case 0x10ec0889: 8848 case 0x10ec0889:
8405 spec->stream_name_analog = "ALC889 Analog"; 8849 spec->stream_name_analog = "ALC889 Analog";
@@ -8452,6 +8896,13 @@ static int patch_alc883(struct hda_codec *codec)
8452#define alc262_modes alc260_modes 8896#define alc262_modes alc260_modes
8453#define alc262_capture_source alc882_capture_source 8897#define alc262_capture_source alc882_capture_source
8454 8898
8899static hda_nid_t alc262_dmic_adc_nids[1] = {
8900 /* ADC0 */
8901 0x09
8902};
8903
8904static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
8905
8455static struct snd_kcontrol_new alc262_base_mixer[] = { 8906static struct snd_kcontrol_new alc262_base_mixer[] = {
8456 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 8907 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8457 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), 8908 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
@@ -8833,10 +9284,10 @@ static struct hda_verb alc262_init_verbs[] = {
8833 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, 9284 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8834 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, 9285 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8835 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, 9286 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8836 9287
8837 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, 9288 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8838 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, 9289 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8839 9290
8840 /* FIXME: use matrix-type input source selection */ 9291 /* FIXME: use matrix-type input source selection */
8841 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ 9292 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8842 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ 9293 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
@@ -8858,6 +9309,12 @@ static struct hda_verb alc262_init_verbs[] = {
8858 { } 9309 { }
8859}; 9310};
8860 9311
9312static struct hda_verb alc262_eapd_verbs[] = {
9313 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9314 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9315 { }
9316};
9317
8861static struct hda_verb alc262_hippo_unsol_verbs[] = { 9318static struct hda_verb alc262_hippo_unsol_verbs[] = {
8862 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 9319 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8863 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 9320 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
@@ -8884,6 +9341,91 @@ static struct hda_verb alc262_sony_unsol_verbs[] = {
8884 {} 9341 {}
8885}; 9342};
8886 9343
9344static struct hda_input_mux alc262_dmic_capture_source = {
9345 .num_items = 2,
9346 .items = {
9347 { "Int DMic", 0x9 },
9348 { "Mic", 0x0 },
9349 },
9350};
9351
9352static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9353 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9354 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9355 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9356 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9357 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9358 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
9359 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
9360 {
9361 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9362 /* The multiple "Capture Source" controls confuse alsamixer
9363 * So call somewhat different..
9364 */
9365 /* .name = "Capture Source", */
9366 .name = "Input Source",
9367 .count = 1,
9368 .info = alc_mux_enum_info,
9369 .get = alc_mux_enum_get,
9370 .put = alc_mux_enum_put,
9371 },
9372 { } /* end */
9373};
9374
9375static struct hda_verb alc262_toshiba_s06_verbs[] = {
9376 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9377 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9378 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9379 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9380 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9381 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9382 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9383 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9384 {}
9385};
9386
9387static void alc262_dmic_automute(struct hda_codec *codec)
9388{
9389 unsigned int present;
9390
9391 present = snd_hda_codec_read(codec, 0x18, 0,
9392 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9393 snd_hda_codec_write(codec, 0x22, 0,
9394 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9395}
9396
9397/* toggle speaker-output according to the hp-jack state */
9398static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9399{
9400 unsigned int present;
9401 unsigned char bits;
9402
9403 present = snd_hda_codec_read(codec, 0x15, 0,
9404 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9405 bits = present ? 0 : PIN_OUT;
9406 snd_hda_codec_write(codec, 0x14, 0,
9407 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9408}
9409
9410
9411
9412/* unsolicited event for HP jack sensing */
9413static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9414 unsigned int res)
9415{
9416 if ((res >> 26) == ALC880_HP_EVENT)
9417 alc262_toshiba_s06_speaker_automute(codec);
9418 if ((res >> 26) == ALC880_MIC_EVENT)
9419 alc262_dmic_automute(codec);
9420
9421}
9422
9423static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9424{
9425 alc262_toshiba_s06_speaker_automute(codec);
9426 alc262_dmic_automute(codec);
9427}
9428
8887/* mute/unmute internal speaker according to the hp jack and mute state */ 9429/* mute/unmute internal speaker according to the hp jack and mute state */
8888static void alc262_hippo_automute(struct hda_codec *codec) 9430static void alc262_hippo_automute(struct hda_codec *codec)
8889{ 9431{
@@ -8948,6 +9490,41 @@ static void alc262_hippo1_unsol_event(struct hda_codec *codec,
8948} 9490}
8949 9491
8950/* 9492/*
9493 * nec model
9494 * 0x15 = headphone
9495 * 0x16 = internal speaker
9496 * 0x18 = external mic
9497 */
9498
9499static struct snd_kcontrol_new alc262_nec_mixer[] = {
9500 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9501 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9502
9503 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9504 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9505 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9506
9507 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9508 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9509 { } /* end */
9510};
9511
9512static struct hda_verb alc262_nec_verbs[] = {
9513 /* Unmute Speaker */
9514 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9515
9516 /* Headphone */
9517 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9518 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9519
9520 /* External mic to headphone */
9521 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9522 /* External mic to speaker */
9523 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9524 {}
9525};
9526
9527/*
8951 * fujitsu model 9528 * fujitsu model
8952 * 0x14 = headphone/spdif-out, 0x15 = internal speaker, 9529 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
8953 * 0x1b = port replicator headphone out 9530 * 0x1b = port replicator headphone out
@@ -9179,6 +9756,25 @@ static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
9179 { } /* end */ 9756 { } /* end */
9180}; 9757};
9181 9758
9759static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
9760 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9761 {
9762 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9763 .name = "Master Playback Switch",
9764 .info = snd_hda_mixer_amp_switch_info,
9765 .get = snd_hda_mixer_amp_switch_get,
9766 .put = alc262_sony_master_sw_put,
9767 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9768 },
9769 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9770 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9771 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9772 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9773 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9774 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9775 { } /* end */
9776};
9777
9182/* additional init verbs for Benq laptops */ 9778/* additional init verbs for Benq laptops */
9183static struct hda_verb alc262_EAPD_verbs[] = { 9779static struct hda_verb alc262_EAPD_verbs[] = {
9184 {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, 9780 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
@@ -9427,7 +10023,7 @@ static struct hda_verb alc262_volume_init_verbs[] = {
9427 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 10023 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9428 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 10024 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9429 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 10025 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9430 10026
9431 /* set up input amps for analog loopback */ 10027 /* set up input amps for analog loopback */
9432 /* Amp Indices: DAC = 0, mixer = 1 */ 10028 /* Amp Indices: DAC = 0, mixer = 1 */
9433 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 10029 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
@@ -9482,7 +10078,7 @@ static struct hda_verb alc262_HP_BPC_init_verbs[] = {
9482 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 10078 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9483 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, 10079 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9484 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, 10080 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9485 10081
9486 /* 10082 /*
9487 * Set up output mixers (0x0c - 0x0e) 10083 * Set up output mixers (0x0c - 0x0e)
9488 */ 10084 */
@@ -9643,6 +10239,24 @@ static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
9643 { } 10239 { }
9644}; 10240};
9645 10241
10242static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10243
10244 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10245 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10246 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10247
10248 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10249 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10250 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10251 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10252
10253 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10254 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10255 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10256 {}
10257};
10258
10259
9646#ifdef CONFIG_SND_HDA_POWER_SAVE 10260#ifdef CONFIG_SND_HDA_POWER_SAVE
9647#define alc262_loopbacks alc880_loopbacks 10261#define alc262_loopbacks alc880_loopbacks
9648#endif 10262#endif
@@ -9711,7 +10325,7 @@ static void alc262_auto_init(struct hda_codec *codec)
9711 alc262_auto_init_analog_input(codec); 10325 alc262_auto_init_analog_input(codec);
9712 alc262_auto_init_input_src(codec); 10326 alc262_auto_init_input_src(codec);
9713 if (spec->unsol_event) 10327 if (spec->unsol_event)
9714 alc_sku_automute(codec); 10328 alc_inithook(codec);
9715} 10329}
9716 10330
9717/* 10331/*
@@ -9729,13 +10343,17 @@ static const char *alc262_models[ALC262_MODEL_LAST] = {
9729 [ALC262_BENQ_ED8] = "benq", 10343 [ALC262_BENQ_ED8] = "benq",
9730 [ALC262_BENQ_T31] = "benq-t31", 10344 [ALC262_BENQ_T31] = "benq-t31",
9731 [ALC262_SONY_ASSAMD] = "sony-assamd", 10345 [ALC262_SONY_ASSAMD] = "sony-assamd",
10346 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10347 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
9732 [ALC262_ULTRA] = "ultra", 10348 [ALC262_ULTRA] = "ultra",
9733 [ALC262_LENOVO_3000] = "lenovo-3000", 10349 [ALC262_LENOVO_3000] = "lenovo-3000",
10350 [ALC262_NEC] = "nec",
9734 [ALC262_AUTO] = "auto", 10351 [ALC262_AUTO] = "auto",
9735}; 10352};
9736 10353
9737static struct snd_pci_quirk alc262_cfg_tbl[] = { 10354static struct snd_pci_quirk alc262_cfg_tbl[] = {
9738 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), 10355 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10356 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
9739 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), 10357 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
9740 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), 10358 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
9741 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), 10359 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
@@ -9764,7 +10382,8 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = {
9764 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), 10382 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9765 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), 10383 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
9766 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", 10384 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
9767 ALC262_SONY_ASSAMD), 10385 ALC262_TOSHIBA_RX1),
10386 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
9768 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), 10387 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
9769 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), 10388 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
9770 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), 10389 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
@@ -9918,7 +10537,7 @@ static struct alc_config_preset alc262_presets[] = {
9918 .input_mux = &alc262_capture_source, 10537 .input_mux = &alc262_capture_source,
9919 .unsol_event = alc262_hippo_unsol_event, 10538 .unsol_event = alc262_hippo_unsol_event,
9920 .init_hook = alc262_hippo_automute, 10539 .init_hook = alc262_hippo_automute,
9921 }, 10540 },
9922 [ALC262_ULTRA] = { 10541 [ALC262_ULTRA] = {
9923 .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer }, 10542 .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer },
9924 .init_verbs = { alc262_ultra_verbs }, 10543 .init_verbs = { alc262_ultra_verbs },
@@ -9946,6 +10565,43 @@ static struct alc_config_preset alc262_presets[] = {
9946 .input_mux = &alc262_fujitsu_capture_source, 10565 .input_mux = &alc262_fujitsu_capture_source,
9947 .unsol_event = alc262_lenovo_3000_unsol_event, 10566 .unsol_event = alc262_lenovo_3000_unsol_event,
9948 }, 10567 },
10568 [ALC262_NEC] = {
10569 .mixers = { alc262_nec_mixer },
10570 .init_verbs = { alc262_nec_verbs },
10571 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10572 .dac_nids = alc262_dac_nids,
10573 .hp_nid = 0x03,
10574 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10575 .channel_mode = alc262_modes,
10576 .input_mux = &alc262_capture_source,
10577 },
10578 [ALC262_TOSHIBA_S06] = {
10579 .mixers = { alc262_toshiba_s06_mixer },
10580 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
10581 alc262_eapd_verbs },
10582 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10583 .capsrc_nids = alc262_dmic_capsrc_nids,
10584 .dac_nids = alc262_dac_nids,
10585 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
10586 .dig_out_nid = ALC262_DIGOUT_NID,
10587 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10588 .channel_mode = alc262_modes,
10589 .input_mux = &alc262_dmic_capture_source,
10590 .unsol_event = alc262_toshiba_s06_unsol_event,
10591 .init_hook = alc262_toshiba_s06_init_hook,
10592 },
10593 [ALC262_TOSHIBA_RX1] = {
10594 .mixers = { alc262_toshiba_rx1_mixer },
10595 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
10596 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10597 .dac_nids = alc262_dac_nids,
10598 .hp_nid = 0x03,
10599 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10600 .channel_mode = alc262_modes,
10601 .input_mux = &alc262_capture_source,
10602 .unsol_event = alc262_hippo_unsol_event,
10603 .init_hook = alc262_hippo_automute,
10604 },
9949}; 10605};
9950 10606
9951static int patch_alc262(struct hda_codec *codec) 10607static int patch_alc262(struct hda_codec *codec)
@@ -10004,7 +10660,7 @@ static int patch_alc262(struct hda_codec *codec)
10004 spec->stream_name_analog = "ALC262 Analog"; 10660 spec->stream_name_analog = "ALC262 Analog";
10005 spec->stream_analog_playback = &alc262_pcm_analog_playback; 10661 spec->stream_analog_playback = &alc262_pcm_analog_playback;
10006 spec->stream_analog_capture = &alc262_pcm_analog_capture; 10662 spec->stream_analog_capture = &alc262_pcm_analog_capture;
10007 10663
10008 spec->stream_name_digital = "ALC262 Digital"; 10664 spec->stream_name_digital = "ALC262 Digital";
10009 spec->stream_digital_playback = &alc262_pcm_digital_playback; 10665 spec->stream_digital_playback = &alc262_pcm_digital_playback;
10010 spec->stream_digital_capture = &alc262_pcm_digital_capture; 10666 spec->stream_digital_capture = &alc262_pcm_digital_capture;
@@ -10040,7 +10696,7 @@ static int patch_alc262(struct hda_codec *codec)
10040 if (!spec->loopback.amplist) 10696 if (!spec->loopback.amplist)
10041 spec->loopback.amplist = alc262_loopbacks; 10697 spec->loopback.amplist = alc262_loopbacks;
10042#endif 10698#endif
10043 10699
10044 return 0; 10700 return 0;
10045} 10701}
10046 10702
@@ -10049,7 +10705,7 @@ static int patch_alc262(struct hda_codec *codec)
10049 */ 10705 */
10050#define ALC268_DIGOUT_NID ALC880_DIGOUT_NID 10706#define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10051#define alc268_modes alc260_modes 10707#define alc268_modes alc260_modes
10052 10708
10053static hda_nid_t alc268_dac_nids[2] = { 10709static hda_nid_t alc268_dac_nids[2] = {
10054 /* front, hp */ 10710 /* front, hp */
10055 0x02, 0x03 10711 0x02, 0x03
@@ -10109,6 +10765,14 @@ static struct hda_verb alc268_toshiba_verbs[] = {
10109 { } /* end */ 10765 { } /* end */
10110}; 10766};
10111 10767
10768static struct hda_input_mux alc268_acer_lc_capture_source = {
10769 .num_items = 2,
10770 .items = {
10771 { "i-Mic", 0x6 },
10772 { "E-Mic", 0x0 },
10773 },
10774};
10775
10112/* Acer specific */ 10776/* Acer specific */
10113/* bind volumes of both NID 0x02 and 0x03 */ 10777/* bind volumes of both NID 0x02 and 0x03 */
10114static struct hda_bind_ctls alc268_acer_bind_master_vol = { 10778static struct hda_bind_ctls alc268_acer_bind_master_vol = {
@@ -10161,6 +10825,21 @@ static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
10161 return change; 10825 return change;
10162} 10826}
10163 10827
10828static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
10829 /* output mixer control */
10830 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10831 {
10832 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10833 .name = "Master Playback Switch",
10834 .info = snd_hda_mixer_amp_switch_info,
10835 .get = snd_hda_mixer_amp_switch_get,
10836 .put = alc268_acer_master_sw_put,
10837 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10838 },
10839 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
10840 { }
10841};
10842
10164static struct snd_kcontrol_new alc268_acer_mixer[] = { 10843static struct snd_kcontrol_new alc268_acer_mixer[] = {
10165 /* output mixer control */ 10844 /* output mixer control */
10166 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), 10845 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
@@ -10178,6 +10857,16 @@ static struct snd_kcontrol_new alc268_acer_mixer[] = {
10178 { } 10857 { }
10179}; 10858};
10180 10859
10860static struct hda_verb alc268_acer_aspire_one_verbs[] = {
10861 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10862 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10863 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10864 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10865 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
10866 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
10867 { }
10868};
10869
10181static struct hda_verb alc268_acer_verbs[] = { 10870static struct hda_verb alc268_acer_verbs[] = {
10182 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ 10871 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
10183 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 10872 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
@@ -10185,7 +10874,6 @@ static struct hda_verb alc268_acer_verbs[] = {
10185 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 10874 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10186 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 10875 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10187 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 10876 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10188
10189 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 10877 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10190 { } 10878 { }
10191}; 10879};
@@ -10212,6 +10900,47 @@ static void alc268_acer_init_hook(struct hda_codec *codec)
10212 alc268_acer_automute(codec, 1); 10900 alc268_acer_automute(codec, 1);
10213} 10901}
10214 10902
10903/* toggle speaker-output according to the hp-jack state */
10904static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
10905{
10906 unsigned int present;
10907 unsigned char bits;
10908
10909 present = snd_hda_codec_read(codec, 0x15, 0,
10910 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10911 bits = present ? AMP_IN_MUTE(0) : 0;
10912 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
10913 AMP_IN_MUTE(0), bits);
10914 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
10915 AMP_IN_MUTE(0), bits);
10916}
10917
10918
10919static void alc268_acer_mic_automute(struct hda_codec *codec)
10920{
10921 unsigned int present;
10922
10923 present = snd_hda_codec_read(codec, 0x18, 0,
10924 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10925 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
10926 present ? 0x0 : 0x6);
10927}
10928
10929static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
10930 unsigned int res)
10931{
10932 if ((res >> 26) == ALC880_HP_EVENT)
10933 alc268_aspire_one_speaker_automute(codec);
10934 if ((res >> 26) == ALC880_MIC_EVENT)
10935 alc268_acer_mic_automute(codec);
10936}
10937
10938static void alc268_acer_lc_init_hook(struct hda_codec *codec)
10939{
10940 alc268_aspire_one_speaker_automute(codec);
10941 alc268_acer_mic_automute(codec);
10942}
10943
10215static struct snd_kcontrol_new alc268_dell_mixer[] = { 10944static struct snd_kcontrol_new alc268_dell_mixer[] = {
10216 /* output mixer control */ 10945 /* output mixer control */
10217 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), 10946 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
@@ -10360,7 +11089,7 @@ static struct hda_verb alc268_base_init_verbs[] = {
10360 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 11089 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10361 11090
10362 /* Unmute Selector 23h,24h and set the default input to mic-in */ 11091 /* Unmute Selector 23h,24h and set the default input to mic-in */
10363 11092
10364 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, 11093 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
10365 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 11094 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10366 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, 11095 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
@@ -10559,7 +11288,7 @@ static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
10559 11288
10560 nid = cfg->line_out_pins[0]; 11289 nid = cfg->line_out_pins[0];
10561 if (nid) 11290 if (nid)
10562 alc268_new_analog_output(spec, nid, "Front", 0); 11291 alc268_new_analog_output(spec, nid, "Front", 0);
10563 11292
10564 nid = cfg->speaker_pins[0]; 11293 nid = cfg->speaker_pins[0];
10565 if (nid == 0x1d) { 11294 if (nid == 0x1d) {
@@ -10581,7 +11310,7 @@ static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
10581 if (err < 0) 11310 if (err < 0)
10582 return err; 11311 return err;
10583 } 11312 }
10584 return 0; 11313 return 0;
10585} 11314}
10586 11315
10587/* create playback/capture controls for input pins */ 11316/* create playback/capture controls for input pins */
@@ -10602,7 +11331,7 @@ static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
10602 case 0x1a: 11331 case 0x1a:
10603 idx1 = 2; /* Line In */ 11332 idx1 = 2; /* Line In */
10604 break; 11333 break;
10605 case 0x1c: 11334 case 0x1c:
10606 idx1 = 3; /* CD */ 11335 idx1 = 3; /* CD */
10607 break; 11336 break;
10608 case 0x12: 11337 case 0x12:
@@ -10614,7 +11343,7 @@ static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
10614 } 11343 }
10615 imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; 11344 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
10616 imux->items[imux->num_items].index = idx1; 11345 imux->items[imux->num_items].index = idx1;
10617 imux->num_items++; 11346 imux->num_items++;
10618 } 11347 }
10619 return 0; 11348 return 0;
10620} 11349}
@@ -10644,11 +11373,11 @@ static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
10644 } 11373 }
10645 11374
10646 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ 11375 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
10647 if (line_nid == 0x14) 11376 if (line_nid == 0x14)
10648 dac_vol2 = AMP_OUT_ZERO; 11377 dac_vol2 = AMP_OUT_ZERO;
10649 else if (line_nid == 0x15) 11378 else if (line_nid == 0x15)
10650 dac_vol1 = AMP_OUT_ZERO; 11379 dac_vol1 = AMP_OUT_ZERO;
10651 if (hp_nid == 0x14) 11380 if (hp_nid == 0x14)
10652 dac_vol2 = AMP_OUT_ZERO; 11381 dac_vol2 = AMP_OUT_ZERO;
10653 else if (hp_nid == 0x15) 11382 else if (hp_nid == 0x15)
10654 dac_vol1 = AMP_OUT_ZERO; 11383 dac_vol1 = AMP_OUT_ZERO;
@@ -10728,7 +11457,7 @@ static void alc268_auto_init(struct hda_codec *codec)
10728 alc268_auto_init_mono_speaker_out(codec); 11457 alc268_auto_init_mono_speaker_out(codec);
10729 alc268_auto_init_analog_input(codec); 11458 alc268_auto_init_analog_input(codec);
10730 if (spec->unsol_event) 11459 if (spec->unsol_event)
10731 alc_sku_automute(codec); 11460 alc_inithook(codec);
10732} 11461}
10733 11462
10734/* 11463/*
@@ -10739,6 +11468,7 @@ static const char *alc268_models[ALC268_MODEL_LAST] = {
10739 [ALC268_3ST] = "3stack", 11468 [ALC268_3ST] = "3stack",
10740 [ALC268_TOSHIBA] = "toshiba", 11469 [ALC268_TOSHIBA] = "toshiba",
10741 [ALC268_ACER] = "acer", 11470 [ALC268_ACER] = "acer",
11471 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
10742 [ALC268_DELL] = "dell", 11472 [ALC268_DELL] = "dell",
10743 [ALC268_ZEPTO] = "zepto", 11473 [ALC268_ZEPTO] = "zepto",
10744#ifdef CONFIG_SND_DEBUG 11474#ifdef CONFIG_SND_DEBUG
@@ -10753,11 +11483,14 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = {
10753 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), 11483 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
10754 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), 11484 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
10755 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), 11485 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11486 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11487 ALC268_ACER_ASPIRE_ONE),
10756 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), 11488 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
10757 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), 11489 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
10758 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), 11490 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
10759 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), 11491 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
10760 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), 11492 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
11493 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
10761 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), 11494 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
10762 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), 11495 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
10763 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), 11496 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
@@ -10830,6 +11563,23 @@ static struct alc_config_preset alc268_presets[] = {
10830 .unsol_event = alc268_acer_unsol_event, 11563 .unsol_event = alc268_acer_unsol_event,
10831 .init_hook = alc268_acer_init_hook, 11564 .init_hook = alc268_acer_init_hook,
10832 }, 11565 },
11566 [ALC268_ACER_ASPIRE_ONE] = {
11567 .mixers = { alc268_acer_aspire_one_mixer,
11568 alc268_capture_alt_mixer },
11569 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11570 alc268_acer_aspire_one_verbs },
11571 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11572 .dac_nids = alc268_dac_nids,
11573 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11574 .adc_nids = alc268_adc_nids_alt,
11575 .capsrc_nids = alc268_capsrc_nids,
11576 .hp_nid = 0x03,
11577 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11578 .channel_mode = alc268_modes,
11579 .input_mux = &alc268_acer_lc_capture_source,
11580 .unsol_event = alc268_acer_lc_unsol_event,
11581 .init_hook = alc268_acer_lc_init_hook,
11582 },
10833 [ALC268_DELL] = { 11583 [ALC268_DELL] = {
10834 .mixers = { alc268_dell_mixer, alc268_beep_mixer }, 11584 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
10835 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 11585 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
@@ -10974,7 +11724,7 @@ static int patch_alc268(struct hda_codec *codec)
10974 codec->patch_ops = alc_patch_ops; 11724 codec->patch_ops = alc_patch_ops;
10975 if (board_config == ALC268_AUTO) 11725 if (board_config == ALC268_AUTO)
10976 spec->init_hook = alc268_auto_init; 11726 spec->init_hook = alc268_auto_init;
10977 11727
10978 return 0; 11728 return 0;
10979} 11729}
10980 11730
@@ -10990,6 +11740,14 @@ static hda_nid_t alc269_adc_nids[1] = {
10990 0x08, 11740 0x08,
10991}; 11741};
10992 11742
11743static hda_nid_t alc269_capsrc_nids[1] = {
11744 0x23,
11745};
11746
11747/* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
11748 * not a mux!
11749 */
11750
10993static struct hda_input_mux alc269_eeepc_dmic_capture_source = { 11751static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
10994 .num_items = 2, 11752 .num_items = 2,
10995 .items = { 11753 .items = {
@@ -11016,6 +11774,8 @@ static struct snd_kcontrol_new alc269_base_mixer[] = {
11016 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 11774 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11017 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 11775 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11018 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 11776 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11777 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
11778 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
11019 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 11779 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11020 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), 11780 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11021 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), 11781 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
@@ -11025,6 +11785,28 @@ static struct snd_kcontrol_new alc269_base_mixer[] = {
11025 { } /* end */ 11785 { } /* end */
11026}; 11786};
11027 11787
11788static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
11789 /* output mixer control */
11790 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11791 {
11792 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11793 .name = "Master Playback Switch",
11794 .info = snd_hda_mixer_amp_switch_info,
11795 .get = snd_hda_mixer_amp_switch_get,
11796 .put = alc268_acer_master_sw_put,
11797 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11798 },
11799 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11800 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11801 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11802 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11803 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11804 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11805 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
11806 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
11807 { }
11808};
11809
11028/* bind volumes of both NID 0x0c and 0x0d */ 11810/* bind volumes of both NID 0x0c and 0x0d */
11029static struct hda_bind_ctls alc269_epc_bind_vol = { 11811static struct hda_bind_ctls alc269_epc_bind_vol = {
11030 .ops = &snd_hda_bind_vol, 11812 .ops = &snd_hda_bind_vol,
@@ -11068,75 +11850,72 @@ static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
11068 { } /* end */ 11850 { } /* end */
11069}; 11851};
11070 11852
11071/* 11853/* beep control */
11072 * generic initialization of ADC, input mixers and output mixers 11854static struct snd_kcontrol_new alc269_beep_mixer[] = {
11073 */ 11855 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
11074static struct hda_verb alc269_init_verbs[] = { 11856 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
11075 /* 11857 { } /* end */
11076 * Unmute ADC0 and set the default input to mic-in 11858};
11077 */
11078 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11079 11859
11080 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the 11860static struct hda_verb alc269_quanta_fl1_verbs[] = {
11081 * analog-loopback mixer widget 11861 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11082 * Note: PASD motherboards uses the Line In 2 as the input for 11862 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11083 * front panel mic (mic 2) 11863 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11084 */ 11864 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11085 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ 11865 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11086 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 11866 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11087 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 11867 { }
11088 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 11868};
11089 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11090 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11091 11869
11092 /* 11870/* toggle speaker-output according to the hp-jack state */
11093 * Set up output mixers (0x0c - 0x0e) 11871static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
11094 */ 11872{
11095 /* set vol=0 to output mixers */ 11873 unsigned int present;
11096 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 11874 unsigned char bits;
11097 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11098 11875
11099 /* set up input amps for analog loopback */ 11876 present = snd_hda_codec_read(codec, 0x15, 0,
11100 /* Amp Indices: DAC = 0, mixer = 1 */ 11877 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11101 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 11878 bits = present ? AMP_IN_MUTE(0) : 0;
11102 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 11879 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
11103 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 11880 AMP_IN_MUTE(0), bits);
11104 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 11881 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
11105 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 11882 AMP_IN_MUTE(0), bits);
11106 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11107 11883
11108 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 11884 snd_hda_codec_write(codec, 0x20, 0,
11109 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 11885 AC_VERB_SET_COEF_INDEX, 0x0c);
11110 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 11886 snd_hda_codec_write(codec, 0x20, 0,
11111 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 11887 AC_VERB_SET_PROC_COEF, 0x680);
11112 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11113 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11114 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11115 11888
11116 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 11889 snd_hda_codec_write(codec, 0x20, 0,
11117 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 11890 AC_VERB_SET_COEF_INDEX, 0x0c);
11118 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 11891 snd_hda_codec_write(codec, 0x20, 0,
11119 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 11892 AC_VERB_SET_PROC_COEF, 0x480);
11120 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 11893}
11121 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11122 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11123 11894
11124 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, 11895static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
11125 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, 11896{
11897 unsigned int present;
11126 11898
11127 /* FIXME: use matrix-type input source selection */ 11899 present = snd_hda_codec_read(codec, 0x18, 0,
11128 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ 11900 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11129 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ 11901 snd_hda_codec_write(codec, 0x23, 0,
11130 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 11902 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
11131 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 11903}
11132 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11133 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11134 11904
11135 /* set EAPD */ 11905static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
11136 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, 11906 unsigned int res)
11137 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, 11907{
11138 { } 11908 if ((res >> 26) == ALC880_HP_EVENT)
11139}; 11909 alc269_quanta_fl1_speaker_automute(codec);
11910 if ((res >> 26) == ALC880_MIC_EVENT)
11911 alc269_quanta_fl1_mic_automute(codec);
11912}
11913
11914static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
11915{
11916 alc269_quanta_fl1_speaker_automute(codec);
11917 alc269_quanta_fl1_mic_automute(codec);
11918}
11140 11919
11141static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { 11920static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
11142 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, 11921 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
@@ -11163,42 +11942,42 @@ static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
11163static void alc269_speaker_automute(struct hda_codec *codec) 11942static void alc269_speaker_automute(struct hda_codec *codec)
11164{ 11943{
11165 unsigned int present; 11944 unsigned int present;
11166 unsigned int bits; 11945 unsigned char bits;
11167 11946
11168 present = snd_hda_codec_read(codec, 0x15, 0, 11947 present = snd_hda_codec_read(codec, 0x15, 0,
11169 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 11948 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11170 bits = present ? AMP_IN_MUTE(0) : 0; 11949 bits = present ? AMP_IN_MUTE(0) : 0;
11171 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, 11950 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
11172 AMP_IN_MUTE(0), bits); 11951 AMP_IN_MUTE(0), bits);
11173 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, 11952 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
11174 AMP_IN_MUTE(0), bits); 11953 AMP_IN_MUTE(0), bits);
11175} 11954}
11176 11955
11177static void alc269_eeepc_dmic_automute(struct hda_codec *codec) 11956static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
11178{ 11957{
11179 unsigned int present; 11958 unsigned int present;
11180 11959
11181 present = snd_hda_codec_read(codec, 0x18, 0, AC_VERB_GET_PIN_SENSE, 0) 11960 present = snd_hda_codec_read(codec, 0x18, 0,
11182 & AC_PINSENSE_PRESENCE; 11961 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11183 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, 11962 snd_hda_codec_write(codec, 0x23, 0,
11184 present ? 0 : 5); 11963 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
11185} 11964}
11186 11965
11187static void alc269_eeepc_amic_automute(struct hda_codec *codec) 11966static void alc269_eeepc_amic_automute(struct hda_codec *codec)
11188{ 11967{
11189 unsigned int present; 11968 unsigned int present;
11190 11969
11191 present = snd_hda_codec_read(codec, 0x18, 0, AC_VERB_GET_PIN_SENSE, 0) 11970 present = snd_hda_codec_read(codec, 0x18, 0,
11192 & AC_PINSENSE_PRESENCE; 11971 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11193 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, 11972 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11194 present ? AMP_IN_UNMUTE(0) : AMP_IN_MUTE(0)); 11973 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
11195 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, 11974 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11196 present ? AMP_IN_MUTE(1) : AMP_IN_UNMUTE(1)); 11975 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
11197} 11976}
11198 11977
11199/* unsolicited event for HP jack sensing */ 11978/* unsolicited event for HP jack sensing */
11200static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, 11979static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
11201 unsigned int res) 11980 unsigned int res)
11202{ 11981{
11203 if ((res >> 26) == ALC880_HP_EVENT) 11982 if ((res >> 26) == ALC880_HP_EVENT)
11204 alc269_speaker_automute(codec); 11983 alc269_speaker_automute(codec);
@@ -11215,7 +11994,7 @@ static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
11215 11994
11216/* unsolicited event for HP jack sensing */ 11995/* unsolicited event for HP jack sensing */
11217static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, 11996static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
11218 unsigned int res) 11997 unsigned int res)
11219{ 11998{
11220 if ((res >> 26) == ALC880_HP_EVENT) 11999 if ((res >> 26) == ALC880_HP_EVENT)
11221 alc269_speaker_automute(codec); 12000 alc269_speaker_automute(codec);
@@ -11230,6 +12009,76 @@ static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
11230 alc269_eeepc_amic_automute(codec); 12009 alc269_eeepc_amic_automute(codec);
11231} 12010}
11232 12011
12012/*
12013 * generic initialization of ADC, input mixers and output mixers
12014 */
12015static struct hda_verb alc269_init_verbs[] = {
12016 /*
12017 * Unmute ADC0 and set the default input to mic-in
12018 */
12019 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12020
12021 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12022 * analog-loopback mixer widget
12023 * Note: PASD motherboards uses the Line In 2 as the input for
12024 * front panel mic (mic 2)
12025 */
12026 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12027 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12028 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12029 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12030 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12031 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12032
12033 /*
12034 * Set up output mixers (0x0c - 0x0e)
12035 */
12036 /* set vol=0 to output mixers */
12037 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12038 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12039
12040 /* set up input amps for analog loopback */
12041 /* Amp Indices: DAC = 0, mixer = 1 */
12042 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12043 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12044 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12045 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12046 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12047 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12048
12049 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12050 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12051 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12052 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12053 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12054 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12055 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12056
12057 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12058 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12059 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12060 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12061 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12062 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12063 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12064
12065 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12066 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12067
12068 /* FIXME: use matrix-type input source selection */
12069 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12070 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12071 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12072 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12073 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12074 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12075
12076 /* set EAPD */
12077 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12078 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12079 { }
12080};
12081
11233/* add playback controls from the parsed DAC table */ 12082/* add playback controls from the parsed DAC table */
11234static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, 12083static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
11235 const struct auto_pin_cfg *cfg) 12084 const struct auto_pin_cfg *cfg)
@@ -11330,7 +12179,7 @@ static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
11330static int alc269_parse_auto_config(struct hda_codec *codec) 12179static int alc269_parse_auto_config(struct hda_codec *codec)
11331{ 12180{
11332 struct alc_spec *spec = codec->spec; 12181 struct alc_spec *spec = codec->spec;
11333 int err; 12182 int i, err;
11334 static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; 12183 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
11335 12184
11336 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, 12185 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
@@ -11353,9 +12202,20 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
11353 if (spec->kctl_alloc) 12202 if (spec->kctl_alloc)
11354 spec->mixers[spec->num_mixers++] = spec->kctl_alloc; 12203 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11355 12204
12205 /* create a beep mixer control if the pin 0x1d isn't assigned */
12206 for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++)
12207 if (spec->autocfg.input_pins[i] == 0x1d)
12208 break;
12209 if (i >= ARRAY_SIZE(spec->autocfg.input_pins))
12210 spec->mixers[spec->num_mixers++] = alc269_beep_mixer;
12211
11356 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; 12212 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs;
11357 spec->num_mux_defs = 1; 12213 spec->num_mux_defs = 1;
11358 spec->input_mux = &spec->private_imux; 12214 spec->input_mux = &spec->private_imux;
12215 /* set default input source */
12216 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12217 0, AC_VERB_SET_CONNECT_SEL,
12218 spec->input_mux->items[0].index);
11359 12219
11360 err = alc_auto_add_mic_boost(codec); 12220 err = alc_auto_add_mic_boost(codec);
11361 if (err < 0) 12221 if (err < 0)
@@ -11380,21 +12240,27 @@ static void alc269_auto_init(struct hda_codec *codec)
11380 alc269_auto_init_hp_out(codec); 12240 alc269_auto_init_hp_out(codec);
11381 alc269_auto_init_analog_input(codec); 12241 alc269_auto_init_analog_input(codec);
11382 if (spec->unsol_event) 12242 if (spec->unsol_event)
11383 alc_sku_automute(codec); 12243 alc_inithook(codec);
11384} 12244}
11385 12245
11386/* 12246/*
11387 * configuration and preset 12247 * configuration and preset
11388 */ 12248 */
11389static const char *alc269_models[ALC269_MODEL_LAST] = { 12249static const char *alc269_models[ALC269_MODEL_LAST] = {
11390 [ALC269_BASIC] = "basic", 12250 [ALC269_BASIC] = "basic",
12251 [ALC269_QUANTA_FL1] = "quanta",
12252 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12253 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901"
11391}; 12254};
11392 12255
11393static struct snd_pci_quirk alc269_cfg_tbl[] = { 12256static struct snd_pci_quirk alc269_cfg_tbl[] = {
12257 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
11394 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", 12258 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
11395 ALC269_ASUS_EEEPC_P703), 12259 ALC269_ASUS_EEEPC_P703),
11396 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", 12260 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
11397 ALC269_ASUS_EEEPC_P901), 12261 ALC269_ASUS_EEEPC_P901),
12262 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12263 ALC269_ASUS_EEEPC_P901),
11398 {} 12264 {}
11399}; 12265};
11400 12266
@@ -11409,6 +12275,18 @@ static struct alc_config_preset alc269_presets[] = {
11409 .channel_mode = alc269_modes, 12275 .channel_mode = alc269_modes,
11410 .input_mux = &alc269_capture_source, 12276 .input_mux = &alc269_capture_source,
11411 }, 12277 },
12278 [ALC269_QUANTA_FL1] = {
12279 .mixers = { alc269_quanta_fl1_mixer },
12280 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12281 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12282 .dac_nids = alc269_dac_nids,
12283 .hp_nid = 0x03,
12284 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12285 .channel_mode = alc269_modes,
12286 .input_mux = &alc269_capture_source,
12287 .unsol_event = alc269_quanta_fl1_unsol_event,
12288 .init_hook = alc269_quanta_fl1_init_hook,
12289 },
11412 [ALC269_ASUS_EEEPC_P703] = { 12290 [ALC269_ASUS_EEEPC_P703] = {
11413 .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer }, 12291 .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer },
11414 .init_verbs = { alc269_init_verbs, 12292 .init_verbs = { alc269_init_verbs,
@@ -11488,6 +12366,7 @@ static int patch_alc269(struct hda_codec *codec)
11488 12366
11489 spec->adc_nids = alc269_adc_nids; 12367 spec->adc_nids = alc269_adc_nids;
11490 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); 12368 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
12369 spec->capsrc_nids = alc269_capsrc_nids;
11491 12370
11492 codec->patch_ops = alc_patch_ops; 12371 codec->patch_ops = alc_patch_ops;
11493 if (board_config == ALC269_AUTO) 12372 if (board_config == ALC269_AUTO)
@@ -11689,7 +12568,7 @@ static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
11689 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), 12568 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11690 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), 12569 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11691 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), 12570 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11692 12571
11693 /*Capture mixer control */ 12572 /*Capture mixer control */
11694 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 12573 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11695 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 12574 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
@@ -11832,20 +12711,20 @@ static struct hda_verb alc861_base_init_verbs[] = {
11832 /* route front mic to ADC1*/ 12711 /* route front mic to ADC1*/
11833 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 12712 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11834 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12713 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11835 12714
11836 /* Unmute DAC0~3 & spdif out*/ 12715 /* Unmute DAC0~3 & spdif out*/
11837 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 12716 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11838 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 12717 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11839 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 12718 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11840 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 12719 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11841 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 12720 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11842 12721
11843 /* Unmute Mixer 14 (mic) 1c (Line in)*/ 12722 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11844 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12723 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11845 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12724 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11846 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12725 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11847 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12726 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11848 12727
11849 /* Unmute Stereo Mixer 15 */ 12728 /* Unmute Stereo Mixer 15 */
11850 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12729 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11851 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12730 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
@@ -11901,13 +12780,13 @@ static struct hda_verb alc861_threestack_init_verbs[] = {
11901 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 12780 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11902 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 12781 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11903 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 12782 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11904 12783
11905 /* Unmute Mixer 14 (mic) 1c (Line in)*/ 12784 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11906 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12785 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11907 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12786 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11908 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12787 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11909 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12788 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11910 12789
11911 /* Unmute Stereo Mixer 15 */ 12790 /* Unmute Stereo Mixer 15 */
11912 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12791 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11913 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12792 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
@@ -11963,13 +12842,13 @@ static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
11963 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 12842 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11964 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 12843 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11965 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 12844 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11966 12845
11967 /* Unmute Mixer 14 (mic) 1c (Line in)*/ 12846 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11968 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12847 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11969 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12848 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11970 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12849 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11971 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12850 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11972 12851
11973 /* Unmute Stereo Mixer 15 */ 12852 /* Unmute Stereo Mixer 15 */
11974 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12853 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11975 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12854 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
@@ -12034,7 +12913,7 @@ static struct hda_verb alc861_asus_init_verbs[] = {
12034 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12913 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12035 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12914 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12036 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12915 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12037 12916
12038 /* Unmute Stereo Mixer 15 */ 12917 /* Unmute Stereo Mixer 15 */
12039 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12918 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12040 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12919 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
@@ -12071,20 +12950,20 @@ static struct hda_verb alc861_auto_init_verbs[] = {
12071 */ 12950 */
12072 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ 12951 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
12073 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12952 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12074 12953
12075 /* Unmute DAC0~3 & spdif out*/ 12954 /* Unmute DAC0~3 & spdif out*/
12076 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 12955 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12077 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 12956 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12078 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 12957 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12079 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 12958 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12080 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 12959 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12081 12960
12082 /* Unmute Mixer 14 (mic) 1c (Line in)*/ 12961 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12083 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12962 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12084 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12963 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12085 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12964 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12086 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12965 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12087 12966
12088 /* Unmute Stereo Mixer 15 */ 12967 /* Unmute Stereo Mixer 15 */
12089 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12968 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12090 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12969 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
@@ -12442,7 +13321,7 @@ static void alc861_auto_init(struct hda_codec *codec)
12442 alc861_auto_init_hp_out(codec); 13321 alc861_auto_init_hp_out(codec);
12443 alc861_auto_init_analog_input(codec); 13322 alc861_auto_init_analog_input(codec);
12444 if (spec->unsol_event) 13323 if (spec->unsol_event)
12445 alc_sku_automute(codec); 13324 alc_inithook(codec);
12446} 13325}
12447 13326
12448#ifdef CONFIG_SND_HDA_POWER_SAVE 13327#ifdef CONFIG_SND_HDA_POWER_SAVE
@@ -12659,7 +13538,7 @@ static int patch_alc861(struct hda_codec *codec)
12659 if (!spec->loopback.amplist) 13538 if (!spec->loopback.amplist)
12660 spec->loopback.amplist = alc861_loopbacks; 13539 spec->loopback.amplist = alc861_loopbacks;
12661#endif 13540#endif
12662 13541
12663 return 0; 13542 return 0;
12664} 13543}
12665 13544
@@ -12913,7 +13792,7 @@ static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
12913 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 13792 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12914 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 13793 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12915 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 13794 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12916 13795
12917 { } /* end */ 13796 { } /* end */
12918}; 13797};
12919 13798
@@ -13058,7 +13937,7 @@ static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
13058 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 13937 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13059 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, 13938 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
13060 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 13939 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13061 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, 13940 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13062 {} 13941 {}
13063}; 13942};
13064 13943
@@ -13120,7 +13999,7 @@ static struct hda_verb alc861vd_dallas_verbs[] = {
13120 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 13999 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13121 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 14000 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13122 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 14001 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13123 14002
13124 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 14003 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13125 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 14004 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13126 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 14005 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
@@ -13145,7 +14024,7 @@ static struct hda_verb alc861vd_dallas_verbs[] = {
13145 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 14024 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13146 14025
13147 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 14026 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13148 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, 14027 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13149 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 14028 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13150 14029
13151 { } /* end */ 14030 { } /* end */
@@ -13304,7 +14183,7 @@ static struct alc_config_preset alc861vd_presets[] = {
13304 .input_mux = &alc861vd_hp_capture_source, 14183 .input_mux = &alc861vd_hp_capture_source,
13305 .unsol_event = alc861vd_dallas_unsol_event, 14184 .unsol_event = alc861vd_dallas_unsol_event,
13306 .init_hook = alc861vd_dallas_automute, 14185 .init_hook = alc861vd_dallas_automute,
13307 }, 14186 },
13308}; 14187};
13309 14188
13310/* 14189/*
@@ -13554,7 +14433,7 @@ static void alc861vd_auto_init(struct hda_codec *codec)
13554 alc861vd_auto_init_analog_input(codec); 14433 alc861vd_auto_init_analog_input(codec);
13555 alc861vd_auto_init_input_src(codec); 14434 alc861vd_auto_init_input_src(codec);
13556 if (spec->unsol_event) 14435 if (spec->unsol_event)
13557 alc_sku_automute(codec); 14436 alc_inithook(codec);
13558} 14437}
13559 14438
13560static int patch_alc861vd(struct hda_codec *codec) 14439static int patch_alc861vd(struct hda_codec *codec)
@@ -13883,13 +14762,120 @@ static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
13883 { } /* end */ 14762 { } /* end */
13884}; 14763};
13885 14764
14765static struct hda_bind_ctls alc663_asus_bind_master_vol = {
14766 .ops = &snd_hda_bind_vol,
14767 .values = {
14768 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
14769 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
14770 0
14771 },
14772};
14773
14774static struct hda_bind_ctls alc663_asus_one_bind_switch = {
14775 .ops = &snd_hda_bind_sw,
14776 .values = {
14777 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14778 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
14779 0
14780 },
14781};
14782
13886static struct snd_kcontrol_new alc663_m51va_mixer[] = { 14783static struct snd_kcontrol_new alc663_m51va_mixer[] = {
14784 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14785 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
14786 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14787 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14788 { } /* end */
14789};
14790
14791static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
14792 .ops = &snd_hda_bind_sw,
14793 .values = {
14794 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14795 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
14796 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
14797 0
14798 },
14799};
14800
14801static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
14802 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14803 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
14804 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14805 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14806 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14807 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14808
14809 { } /* end */
14810};
14811
14812static struct hda_bind_ctls alc663_asus_four_bind_switch = {
14813 .ops = &snd_hda_bind_sw,
14814 .values = {
14815 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14816 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
14817 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
14818 0
14819 },
14820};
14821
14822static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
14823 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14824 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
14825 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14826 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14827 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14828 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14829 { } /* end */
14830};
14831
14832static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
13887 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), 14833 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13888 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), 14834 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14835 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14836 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14837 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14838 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14839 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14840 { } /* end */
14841};
14842
14843static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
14844 .ops = &snd_hda_bind_vol,
14845 .values = {
14846 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
14847 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
14848 0
14849 },
14850};
14851
14852static struct hda_bind_ctls alc663_asus_two_bind_switch = {
14853 .ops = &snd_hda_bind_sw,
14854 .values = {
14855 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14856 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
14857 0
14858 },
14859};
14860
14861static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
14862 HDA_BIND_VOL("Master Playback Volume",
14863 &alc663_asus_two_bind_master_vol),
14864 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
14865 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13889 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), 14866 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13890 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 14867 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13891 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 14868 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13892 HDA_CODEC_MUTE("DMic Playback Switch", 0x23, 0x9, HDA_INPUT), 14869 { } /* end */
14870};
14871
14872static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
14873 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14874 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
14875 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14876 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14877 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14878 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13893 { } /* end */ 14879 { } /* end */
13894}; 14880};
13895 14881
@@ -14074,14 +15060,81 @@ static struct hda_verb alc663_auto_init_verbs[] = {
14074}; 15060};
14075 15061
14076static struct hda_verb alc663_m51va_init_verbs[] = { 15062static struct hda_verb alc663_m51va_init_verbs[] = {
15063 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15064 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14077 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 15065 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14078 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 15066 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14079 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ 15067 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15068 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15069 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15070 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15071 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15072 {}
15073};
14080 15074
14081 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, 15075static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15076 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15077 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15078 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15079 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15080 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15081 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15082 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15083 {}
15084};
14082 15085
15086static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15087 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15088 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15089 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15090 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15091 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15092 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15093 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15094 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15095 {}
15096};
15097
15098static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15099 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15100 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15101 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15102 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15103 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15104 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15105 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15106 {}
15107};
15108
15109static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15110 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15111 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15112 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15113 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15114 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15115 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15116 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15117 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15118 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14083 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, 15119 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14084 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 15120 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15121 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15122 {}
15123};
15124
15125static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15126 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15127 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15128 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15129 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15130 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15131 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15132 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15133 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15134 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15135 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15136 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15137 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14085 {} 15138 {}
14086}; 15139};
14087 15140
@@ -14110,6 +15163,14 @@ static struct hda_verb alc663_g50v_init_verbs[] = {
14110 {} 15163 {}
14111}; 15164};
14112 15165
15166static struct hda_verb alc662_ecs_init_verbs[] = {
15167 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15168 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15169 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15170 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15171 {}
15172};
15173
14113/* capture mixer elements */ 15174/* capture mixer elements */
14114static struct snd_kcontrol_new alc662_capture_mixer[] = { 15175static struct snd_kcontrol_new alc662_capture_mixer[] = {
14115 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), 15176 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
@@ -14129,6 +15190,12 @@ static struct snd_kcontrol_new alc662_capture_mixer[] = {
14129 { } /* end */ 15190 { } /* end */
14130}; 15191};
14131 15192
15193static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15194 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15195 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15196 { } /* end */
15197};
15198
14132static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) 15199static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
14133{ 15200{
14134 unsigned int present; 15201 unsigned int present;
@@ -14209,12 +15276,12 @@ static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
14209 if (present) { 15276 if (present) {
14210 /* mute internal speaker */ 15277 /* mute internal speaker */
14211 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, 15278 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
14212 HDA_AMP_MUTE, HDA_AMP_MUTE); 15279 HDA_AMP_MUTE, HDA_AMP_MUTE);
14213 } else { 15280 } else {
14214 /* unmute internal speaker if necessary */ 15281 /* unmute internal speaker if necessary */
14215 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); 15282 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
14216 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, 15283 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
14217 HDA_AMP_MUTE, mute); 15284 HDA_AMP_MUTE, mute);
14218 } 15285 }
14219} 15286}
14220 15287
@@ -14237,11 +15304,108 @@ static void alc663_m51va_speaker_automute(struct hda_codec *codec)
14237 unsigned char bits; 15304 unsigned char bits;
14238 15305
14239 present = snd_hda_codec_read(codec, 0x21, 0, 15306 present = snd_hda_codec_read(codec, 0x21, 0,
14240 AC_VERB_GET_PIN_SENSE, 0) 15307 AC_VERB_GET_PIN_SENSE, 0)
14241 & AC_PINSENSE_PRESENCE; 15308 & AC_PINSENSE_PRESENCE;
14242 bits = present ? HDA_AMP_MUTE : 0; 15309 bits = present ? HDA_AMP_MUTE : 0;
14243 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 15310 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14244 HDA_AMP_MUTE, bits); 15311 AMP_IN_MUTE(0), bits);
15312 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15313 AMP_IN_MUTE(0), bits);
15314}
15315
15316static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15317{
15318 unsigned int present;
15319 unsigned char bits;
15320
15321 present = snd_hda_codec_read(codec, 0x21, 0,
15322 AC_VERB_GET_PIN_SENSE, 0)
15323 & AC_PINSENSE_PRESENCE;
15324 bits = present ? HDA_AMP_MUTE : 0;
15325 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15326 AMP_IN_MUTE(0), bits);
15327 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15328 AMP_IN_MUTE(0), bits);
15329 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15330 AMP_IN_MUTE(0), bits);
15331 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15332 AMP_IN_MUTE(0), bits);
15333}
15334
15335static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15336{
15337 unsigned int present;
15338 unsigned char bits;
15339
15340 present = snd_hda_codec_read(codec, 0x15, 0,
15341 AC_VERB_GET_PIN_SENSE, 0)
15342 & AC_PINSENSE_PRESENCE;
15343 bits = present ? HDA_AMP_MUTE : 0;
15344 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15345 AMP_IN_MUTE(0), bits);
15346 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15347 AMP_IN_MUTE(0), bits);
15348 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15349 AMP_IN_MUTE(0), bits);
15350 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15351 AMP_IN_MUTE(0), bits);
15352}
15353
15354static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15355{
15356 unsigned int present;
15357 unsigned char bits;
15358
15359 present = snd_hda_codec_read(codec, 0x1b, 0,
15360 AC_VERB_GET_PIN_SENSE, 0)
15361 & AC_PINSENSE_PRESENCE;
15362 bits = present ? 0 : PIN_OUT;
15363 snd_hda_codec_write(codec, 0x14, 0,
15364 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15365}
15366
15367static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15368{
15369 unsigned int present1, present2;
15370
15371 present1 = snd_hda_codec_read(codec, 0x21, 0,
15372 AC_VERB_GET_PIN_SENSE, 0)
15373 & AC_PINSENSE_PRESENCE;
15374 present2 = snd_hda_codec_read(codec, 0x15, 0,
15375 AC_VERB_GET_PIN_SENSE, 0)
15376 & AC_PINSENSE_PRESENCE;
15377
15378 if (present1 || present2) {
15379 snd_hda_codec_write_cache(codec, 0x14, 0,
15380 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15381 } else {
15382 snd_hda_codec_write_cache(codec, 0x14, 0,
15383 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15384 }
15385}
15386
15387static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15388{
15389 unsigned int present1, present2;
15390
15391 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15392 AC_VERB_GET_PIN_SENSE, 0)
15393 & AC_PINSENSE_PRESENCE;
15394 present2 = snd_hda_codec_read(codec, 0x15, 0,
15395 AC_VERB_GET_PIN_SENSE, 0)
15396 & AC_PINSENSE_PRESENCE;
15397
15398 if (present1 || present2) {
15399 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15400 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15401 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15402 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15403 } else {
15404 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15405 AMP_IN_MUTE(0), 0);
15406 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15407 AMP_IN_MUTE(0), 0);
15408 }
14245} 15409}
14246 15410
14247static void alc663_m51va_mic_automute(struct hda_codec *codec) 15411static void alc663_m51va_mic_automute(struct hda_codec *codec)
@@ -14249,16 +15413,16 @@ static void alc663_m51va_mic_automute(struct hda_codec *codec)
14249 unsigned int present; 15413 unsigned int present;
14250 15414
14251 present = snd_hda_codec_read(codec, 0x18, 0, 15415 present = snd_hda_codec_read(codec, 0x18, 0,
14252 AC_VERB_GET_PIN_SENSE, 0) 15416 AC_VERB_GET_PIN_SENSE, 0)
14253 & AC_PINSENSE_PRESENCE; 15417 & AC_PINSENSE_PRESENCE;
14254 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, 15418 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14255 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); 15419 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
14256 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, 15420 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14257 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); 15421 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
14258 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, 15422 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14259 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); 15423 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
14260 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, 15424 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14261 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); 15425 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
14262} 15426}
14263 15427
14264static void alc663_m51va_unsol_event(struct hda_codec *codec, 15428static void alc663_m51va_unsol_event(struct hda_codec *codec,
@@ -14280,6 +15444,121 @@ static void alc663_m51va_inithook(struct hda_codec *codec)
14280 alc663_m51va_mic_automute(codec); 15444 alc663_m51va_mic_automute(codec);
14281} 15445}
14282 15446
15447/* ***************** Mode1 ******************************/
15448static void alc663_mode1_unsol_event(struct hda_codec *codec,
15449 unsigned int res)
15450{
15451 switch (res >> 26) {
15452 case ALC880_HP_EVENT:
15453 alc663_m51va_speaker_automute(codec);
15454 break;
15455 case ALC880_MIC_EVENT:
15456 alc662_eeepc_mic_automute(codec);
15457 break;
15458 }
15459}
15460
15461static void alc663_mode1_inithook(struct hda_codec *codec)
15462{
15463 alc663_m51va_speaker_automute(codec);
15464 alc662_eeepc_mic_automute(codec);
15465}
15466/* ***************** Mode2 ******************************/
15467static void alc662_mode2_unsol_event(struct hda_codec *codec,
15468 unsigned int res)
15469{
15470 switch (res >> 26) {
15471 case ALC880_HP_EVENT:
15472 alc662_f5z_speaker_automute(codec);
15473 break;
15474 case ALC880_MIC_EVENT:
15475 alc662_eeepc_mic_automute(codec);
15476 break;
15477 }
15478}
15479
15480static void alc662_mode2_inithook(struct hda_codec *codec)
15481{
15482 alc662_f5z_speaker_automute(codec);
15483 alc662_eeepc_mic_automute(codec);
15484}
15485/* ***************** Mode3 ******************************/
15486static void alc663_mode3_unsol_event(struct hda_codec *codec,
15487 unsigned int res)
15488{
15489 switch (res >> 26) {
15490 case ALC880_HP_EVENT:
15491 alc663_two_hp_m1_speaker_automute(codec);
15492 break;
15493 case ALC880_MIC_EVENT:
15494 alc662_eeepc_mic_automute(codec);
15495 break;
15496 }
15497}
15498
15499static void alc663_mode3_inithook(struct hda_codec *codec)
15500{
15501 alc663_two_hp_m1_speaker_automute(codec);
15502 alc662_eeepc_mic_automute(codec);
15503}
15504/* ***************** Mode4 ******************************/
15505static void alc663_mode4_unsol_event(struct hda_codec *codec,
15506 unsigned int res)
15507{
15508 switch (res >> 26) {
15509 case ALC880_HP_EVENT:
15510 alc663_21jd_two_speaker_automute(codec);
15511 break;
15512 case ALC880_MIC_EVENT:
15513 alc662_eeepc_mic_automute(codec);
15514 break;
15515 }
15516}
15517
15518static void alc663_mode4_inithook(struct hda_codec *codec)
15519{
15520 alc663_21jd_two_speaker_automute(codec);
15521 alc662_eeepc_mic_automute(codec);
15522}
15523/* ***************** Mode5 ******************************/
15524static void alc663_mode5_unsol_event(struct hda_codec *codec,
15525 unsigned int res)
15526{
15527 switch (res >> 26) {
15528 case ALC880_HP_EVENT:
15529 alc663_15jd_two_speaker_automute(codec);
15530 break;
15531 case ALC880_MIC_EVENT:
15532 alc662_eeepc_mic_automute(codec);
15533 break;
15534 }
15535}
15536
15537static void alc663_mode5_inithook(struct hda_codec *codec)
15538{
15539 alc663_15jd_two_speaker_automute(codec);
15540 alc662_eeepc_mic_automute(codec);
15541}
15542/* ***************** Mode6 ******************************/
15543static void alc663_mode6_unsol_event(struct hda_codec *codec,
15544 unsigned int res)
15545{
15546 switch (res >> 26) {
15547 case ALC880_HP_EVENT:
15548 alc663_two_hp_m2_speaker_automute(codec);
15549 break;
15550 case ALC880_MIC_EVENT:
15551 alc662_eeepc_mic_automute(codec);
15552 break;
15553 }
15554}
15555
15556static void alc663_mode6_inithook(struct hda_codec *codec)
15557{
15558 alc663_two_hp_m2_speaker_automute(codec);
15559 alc662_eeepc_mic_automute(codec);
15560}
15561
14283static void alc663_g71v_hp_automute(struct hda_codec *codec) 15562static void alc663_g71v_hp_automute(struct hda_codec *codec)
14284{ 15563{
14285 unsigned int present; 15564 unsigned int present;
@@ -14350,6 +15629,46 @@ static void alc663_g50v_inithook(struct hda_codec *codec)
14350 alc662_eeepc_mic_automute(codec); 15629 alc662_eeepc_mic_automute(codec);
14351} 15630}
14352 15631
15632/* bind hp and internal speaker mute (with plug check) */
15633static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
15634 struct snd_ctl_elem_value *ucontrol)
15635{
15636 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
15637 long *valp = ucontrol->value.integer.value;
15638 int change;
15639
15640 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
15641 HDA_AMP_MUTE,
15642 valp[0] ? 0 : HDA_AMP_MUTE);
15643 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
15644 HDA_AMP_MUTE,
15645 valp[1] ? 0 : HDA_AMP_MUTE);
15646 if (change)
15647 alc262_hippo1_automute(codec);
15648 return change;
15649}
15650
15651static struct snd_kcontrol_new alc662_ecs_mixer[] = {
15652 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15653 {
15654 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15655 .name = "Master Playback Switch",
15656 .info = snd_hda_mixer_amp_switch_info,
15657 .get = snd_hda_mixer_amp_switch_get,
15658 .put = alc662_ecs_master_sw_put,
15659 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15660 },
15661
15662 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
15663 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
15664 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
15665
15666 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15667 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15668 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15669 { } /* end */
15670};
15671
14353#ifdef CONFIG_SND_HDA_POWER_SAVE 15672#ifdef CONFIG_SND_HDA_POWER_SAVE
14354#define alc662_loopbacks alc880_loopbacks 15673#define alc662_loopbacks alc880_loopbacks
14355#endif 15674#endif
@@ -14372,21 +15691,68 @@ static const char *alc662_models[ALC662_MODEL_LAST] = {
14372 [ALC662_LENOVO_101E] = "lenovo-101e", 15691 [ALC662_LENOVO_101E] = "lenovo-101e",
14373 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", 15692 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
14374 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", 15693 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
15694 [ALC662_ECS] = "ecs",
14375 [ALC663_ASUS_M51VA] = "m51va", 15695 [ALC663_ASUS_M51VA] = "m51va",
14376 [ALC663_ASUS_G71V] = "g71v", 15696 [ALC663_ASUS_G71V] = "g71v",
14377 [ALC663_ASUS_H13] = "h13", 15697 [ALC663_ASUS_H13] = "h13",
14378 [ALC663_ASUS_G50V] = "g50v", 15698 [ALC663_ASUS_G50V] = "g50v",
15699 [ALC663_ASUS_MODE1] = "asus-mode1",
15700 [ALC662_ASUS_MODE2] = "asus-mode2",
15701 [ALC663_ASUS_MODE3] = "asus-mode3",
15702 [ALC663_ASUS_MODE4] = "asus-mode4",
15703 [ALC663_ASUS_MODE5] = "asus-mode5",
15704 [ALC663_ASUS_MODE6] = "asus-mode6",
14379 [ALC662_AUTO] = "auto", 15705 [ALC662_AUTO] = "auto",
14380}; 15706};
14381 15707
14382static struct snd_pci_quirk alc662_cfg_tbl[] = { 15708static struct snd_pci_quirk alc662_cfg_tbl[] = {
14383 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS G71V", ALC663_ASUS_G71V),
14384 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), 15709 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
14385 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V), 15710 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
14386 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), 15711 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
14387 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), 15712 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
14388 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), 15713 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
15714 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
15715 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),
15716 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
15717 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
15718 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
15719 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),
15720 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
15721 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
15722 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
15723 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
15724 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
15725 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
15726 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
15727 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
15728 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
15729 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
15730 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
15731 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
15732 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
15733 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
15734 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
15735 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
15736 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
15737 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
15738 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
15739 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
15740 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
15741 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
15742 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
15743 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
15744 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
15745 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
15746 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
15747 ALC662_3ST_6ch_DIG),
14389 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), 15748 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
15749 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
15750 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
15751 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
15752 ALC662_3ST_6ch_DIG),
15753 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
15754 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
15755 ALC662_3ST_6ch_DIG),
14390 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), 15756 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
14391 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), 15757 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
14392 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), 15758 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
@@ -14477,6 +15843,18 @@ static struct alc_config_preset alc662_presets[] = {
14477 .unsol_event = alc662_eeepc_ep20_unsol_event, 15843 .unsol_event = alc662_eeepc_ep20_unsol_event,
14478 .init_hook = alc662_eeepc_ep20_inithook, 15844 .init_hook = alc662_eeepc_ep20_inithook,
14479 }, 15845 },
15846 [ALC662_ECS] = {
15847 .mixers = { alc662_ecs_mixer, alc662_capture_mixer },
15848 .init_verbs = { alc662_init_verbs,
15849 alc662_ecs_init_verbs },
15850 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15851 .dac_nids = alc662_dac_nids,
15852 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15853 .channel_mode = alc662_3ST_2ch_modes,
15854 .input_mux = &alc662_eeepc_capture_source,
15855 .unsol_event = alc662_eeepc_unsol_event,
15856 .init_hook = alc662_eeepc_inithook,
15857 },
14480 [ALC663_ASUS_M51VA] = { 15858 [ALC663_ASUS_M51VA] = {
14481 .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, 15859 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
14482 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, 15860 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
@@ -14524,6 +15902,91 @@ static struct alc_config_preset alc662_presets[] = {
14524 .unsol_event = alc663_g50v_unsol_event, 15902 .unsol_event = alc663_g50v_unsol_event,
14525 .init_hook = alc663_g50v_inithook, 15903 .init_hook = alc663_g50v_inithook,
14526 }, 15904 },
15905 [ALC663_ASUS_MODE1] = {
15906 .mixers = { alc663_m51va_mixer, alc662_auto_capture_mixer },
15907 .init_verbs = { alc662_init_verbs,
15908 alc663_21jd_amic_init_verbs },
15909 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15910 .hp_nid = 0x03,
15911 .dac_nids = alc662_dac_nids,
15912 .dig_out_nid = ALC662_DIGOUT_NID,
15913 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15914 .channel_mode = alc662_3ST_2ch_modes,
15915 .input_mux = &alc662_eeepc_capture_source,
15916 .unsol_event = alc663_mode1_unsol_event,
15917 .init_hook = alc663_mode1_inithook,
15918 },
15919 [ALC662_ASUS_MODE2] = {
15920 .mixers = { alc662_1bjd_mixer, alc662_auto_capture_mixer },
15921 .init_verbs = { alc662_init_verbs,
15922 alc662_1bjd_amic_init_verbs },
15923 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15924 .dac_nids = alc662_dac_nids,
15925 .dig_out_nid = ALC662_DIGOUT_NID,
15926 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15927 .channel_mode = alc662_3ST_2ch_modes,
15928 .input_mux = &alc662_eeepc_capture_source,
15929 .unsol_event = alc662_mode2_unsol_event,
15930 .init_hook = alc662_mode2_inithook,
15931 },
15932 [ALC663_ASUS_MODE3] = {
15933 .mixers = { alc663_two_hp_m1_mixer, alc662_auto_capture_mixer },
15934 .init_verbs = { alc662_init_verbs,
15935 alc663_two_hp_amic_m1_init_verbs },
15936 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15937 .hp_nid = 0x03,
15938 .dac_nids = alc662_dac_nids,
15939 .dig_out_nid = ALC662_DIGOUT_NID,
15940 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15941 .channel_mode = alc662_3ST_2ch_modes,
15942 .input_mux = &alc662_eeepc_capture_source,
15943 .unsol_event = alc663_mode3_unsol_event,
15944 .init_hook = alc663_mode3_inithook,
15945 },
15946 [ALC663_ASUS_MODE4] = {
15947 .mixers = { alc663_asus_21jd_clfe_mixer,
15948 alc662_auto_capture_mixer},
15949 .init_verbs = { alc662_init_verbs,
15950 alc663_21jd_amic_init_verbs},
15951 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15952 .hp_nid = 0x03,
15953 .dac_nids = alc662_dac_nids,
15954 .dig_out_nid = ALC662_DIGOUT_NID,
15955 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15956 .channel_mode = alc662_3ST_2ch_modes,
15957 .input_mux = &alc662_eeepc_capture_source,
15958 .unsol_event = alc663_mode4_unsol_event,
15959 .init_hook = alc663_mode4_inithook,
15960 },
15961 [ALC663_ASUS_MODE5] = {
15962 .mixers = { alc663_asus_15jd_clfe_mixer,
15963 alc662_auto_capture_mixer },
15964 .init_verbs = { alc662_init_verbs,
15965 alc663_15jd_amic_init_verbs },
15966 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15967 .hp_nid = 0x03,
15968 .dac_nids = alc662_dac_nids,
15969 .dig_out_nid = ALC662_DIGOUT_NID,
15970 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15971 .channel_mode = alc662_3ST_2ch_modes,
15972 .input_mux = &alc662_eeepc_capture_source,
15973 .unsol_event = alc663_mode5_unsol_event,
15974 .init_hook = alc663_mode5_inithook,
15975 },
15976 [ALC663_ASUS_MODE6] = {
15977 .mixers = { alc663_two_hp_m2_mixer, alc662_auto_capture_mixer },
15978 .init_verbs = { alc662_init_verbs,
15979 alc663_two_hp_amic_m2_init_verbs },
15980 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15981 .hp_nid = 0x03,
15982 .dac_nids = alc662_dac_nids,
15983 .dig_out_nid = ALC662_DIGOUT_NID,
15984 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15985 .channel_mode = alc662_3ST_2ch_modes,
15986 .input_mux = &alc662_eeepc_capture_source,
15987 .unsol_event = alc663_mode6_unsol_event,
15988 .init_hook = alc663_mode6_inithook,
15989 },
14527}; 15990};
14528 15991
14529 15992
@@ -14560,15 +16023,15 @@ static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
14560 HDA_OUTPUT)); 16023 HDA_OUTPUT));
14561 if (err < 0) 16024 if (err < 0)
14562 return err; 16025 return err;
14563 err = add_control(spec, ALC_CTL_BIND_MUTE, 16026 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
14564 "Center Playback Switch", 16027 "Center Playback Switch",
14565 HDA_COMPOSE_AMP_VAL(nid, 1, 2, 16028 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
14566 HDA_INPUT)); 16029 HDA_INPUT));
14567 if (err < 0) 16030 if (err < 0)
14568 return err; 16031 return err;
14569 err = add_control(spec, ALC_CTL_BIND_MUTE, 16032 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
14570 "LFE Playback Switch", 16033 "LFE Playback Switch",
14571 HDA_COMPOSE_AMP_VAL(nid, 2, 2, 16034 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
14572 HDA_INPUT)); 16035 HDA_INPUT));
14573 if (err < 0) 16036 if (err < 0)
14574 return err; 16037 return err;
@@ -14580,9 +16043,9 @@ static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
14580 if (err < 0) 16043 if (err < 0)
14581 return err; 16044 return err;
14582 sprintf(name, "%s Playback Switch", chname[i]); 16045 sprintf(name, "%s Playback Switch", chname[i]);
14583 err = add_control(spec, ALC_CTL_BIND_MUTE, name, 16046 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14584 HDA_COMPOSE_AMP_VAL(nid, 3, 2, 16047 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
14585 HDA_INPUT)); 16048 3, 0, HDA_INPUT));
14586 if (err < 0) 16049 if (err < 0)
14587 return err; 16050 return err;
14588 } 16051 }
@@ -14777,7 +16240,7 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
14777 16240
14778 spec->num_mux_defs = 1; 16241 spec->num_mux_defs = 1;
14779 spec->input_mux = &spec->private_imux; 16242 spec->input_mux = &spec->private_imux;
14780 16243
14781 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; 16244 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
14782 if (codec->vendor_id == 0x10ec0663) 16245 if (codec->vendor_id == 0x10ec0663)
14783 spec->init_verbs[spec->num_init_verbs++] = 16246 spec->init_verbs[spec->num_init_verbs++] =
@@ -14801,7 +16264,7 @@ static void alc662_auto_init(struct hda_codec *codec)
14801 alc662_auto_init_analog_input(codec); 16264 alc662_auto_init_analog_input(codec);
14802 alc662_auto_init_input_src(codec); 16265 alc662_auto_init_input_src(codec);
14803 if (spec->unsol_event) 16266 if (spec->unsol_event)
14804 alc_sku_automute(codec); 16267 alc_inithook(codec);
14805} 16268}
14806 16269
14807static int patch_alc662(struct hda_codec *codec) 16270static int patch_alc662(struct hda_codec *codec)
@@ -14846,6 +16309,9 @@ static int patch_alc662(struct hda_codec *codec)
14846 if (codec->vendor_id == 0x10ec0663) { 16309 if (codec->vendor_id == 0x10ec0663) {
14847 spec->stream_name_analog = "ALC663 Analog"; 16310 spec->stream_name_analog = "ALC663 Analog";
14848 spec->stream_name_digital = "ALC663 Digital"; 16311 spec->stream_name_digital = "ALC663 Digital";
16312 } else if (codec->vendor_id == 0x10ec0272) {
16313 spec->stream_name_analog = "ALC272 Analog";
16314 spec->stream_name_digital = "ALC272 Digital";
14849 } else { 16315 } else {
14850 spec->stream_name_analog = "ALC662 Analog"; 16316 spec->stream_name_analog = "ALC662 Analog";
14851 spec->stream_name_digital = "ALC662 Digital"; 16317 spec->stream_name_digital = "ALC662 Digital";
@@ -14883,6 +16349,7 @@ struct hda_codec_preset snd_hda_preset_realtek[] = {
14883 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, 16349 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
14884 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, 16350 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
14885 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, 16351 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16352 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
14886 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", 16353 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
14887 .patch = patch_alc861 }, 16354 .patch = patch_alc861 },
14888 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, 16355 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
@@ -14896,10 +16363,15 @@ struct hda_codec_preset snd_hda_preset_realtek[] = {
14896 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, 16363 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
14897 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, 16364 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
14898 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, 16365 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16366 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16367 .patch = patch_alc882 }, /* should be patch_alc883() in future */
14899 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", 16368 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
14900 .patch = patch_alc882 }, /* should be patch_alc883() in future */ 16369 .patch = patch_alc882 }, /* should be patch_alc883() in future */
14901 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, 16370 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16371 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
14902 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, 16372 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16373 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
16374 .patch = patch_alc883 },
14903 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, 16375 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
14904 {} /* terminator */ 16376 {} /* terminator */
14905}; 16377};