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.c1816
1 files changed, 1620 insertions, 196 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 66025161bd69..0b6e682c46d0 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;
@@ -855,7 +871,7 @@ static void alc_subsystem_id(struct hda_codec *codec,
855 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) 871 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
856 goto do_sku; 872 goto do_sku;
857 873
858 /* 874 /*
859 * 31~30 : port conetcivity 875 * 31~30 : port conetcivity
860 * 29~21 : reserve 876 * 29~21 : reserve
861 * 20 : PCBEEP input 877 * 20 : PCBEEP input
@@ -946,7 +962,7 @@ do_sku:
946 tmp = snd_hda_codec_read(codec, 0x20, 0, 962 tmp = snd_hda_codec_read(codec, 0x20, 0,
947 AC_VERB_GET_PROC_COEF, 0); 963 AC_VERB_GET_PROC_COEF, 0);
948 snd_hda_codec_write(codec, 0x20, 0, 964 snd_hda_codec_write(codec, 0x20, 0,
949 AC_VERB_SET_COEF_INDEX, 7); 965 AC_VERB_SET_COEF_INDEX, 7);
950 snd_hda_codec_write(codec, 0x20, 0, 966 snd_hda_codec_write(codec, 0x20, 0,
951 AC_VERB_SET_PROC_COEF, 967 AC_VERB_SET_PROC_COEF,
952 tmp | 0x2010); 968 tmp | 0x2010);
@@ -961,7 +977,7 @@ do_sku:
961 tmp = snd_hda_codec_read(codec, 0x20, 0, 977 tmp = snd_hda_codec_read(codec, 0x20, 0,
962 AC_VERB_GET_PROC_COEF, 0); 978 AC_VERB_GET_PROC_COEF, 0);
963 snd_hda_codec_write(codec, 0x20, 0, 979 snd_hda_codec_write(codec, 0x20, 0,
964 AC_VERB_SET_COEF_INDEX, 7); 980 AC_VERB_SET_COEF_INDEX, 7);
965 snd_hda_codec_write(codec, 0x20, 0, 981 snd_hda_codec_write(codec, 0x20, 0,
966 AC_VERB_SET_PROC_COEF, 982 AC_VERB_SET_PROC_COEF,
967 tmp | 0x3000); 983 tmp | 0x3000);
@@ -970,7 +986,7 @@ do_sku:
970 default: 986 default:
971 break; 987 break;
972 } 988 }
973 989
974 /* is laptop or Desktop and enable the function "Mute internal speaker 990 /* is laptop or Desktop and enable the function "Mute internal speaker
975 * when the external headphone out jack is plugged" 991 * when the external headphone out jack is plugged"
976 */ 992 */
@@ -1006,6 +1022,7 @@ do_sku:
1006 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, 1022 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1007 AC_VERB_SET_UNSOLICITED_ENABLE, 1023 AC_VERB_SET_UNSOLICITED_ENABLE,
1008 AC_USRSP_EN | ALC880_HP_EVENT); 1024 AC_USRSP_EN | ALC880_HP_EVENT);
1025
1009 spec->unsol_event = alc_sku_unsol_event; 1026 spec->unsol_event = alc_sku_unsol_event;
1010} 1027}
1011 1028
@@ -1296,7 +1313,7 @@ static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1296 * 1313 *
1297 * The system also has a pair of internal speakers, and a headphone jack. 1314 * 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. 1315 * These are both connected to Line2 on the codec, hence to DAC 02.
1299 * 1316 *
1300 * There is a variable resistor to control the speaker or headphone 1317 * There is a variable resistor to control the speaker or headphone
1301 * volume. This is a hardware-only device without a software API. 1318 * volume. This is a hardware-only device without a software API.
1302 * 1319 *
@@ -1824,7 +1841,7 @@ static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1824 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1841 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1825 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1842 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1826 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1843 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1827 1844
1828 { } 1845 { }
1829}; 1846};
1830 1847
@@ -1869,7 +1886,7 @@ static struct hda_verb alc880_uniwill_init_verbs[] = {
1869 1886
1870/* 1887/*
1871* Uniwill P53 1888* Uniwill P53
1872* HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, 1889* HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1873 */ 1890 */
1874static struct hda_verb alc880_uniwill_p53_init_verbs[] = { 1891static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
1875 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 1892 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
@@ -1968,7 +1985,7 @@ static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
1968static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) 1985static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
1969{ 1986{
1970 unsigned int present; 1987 unsigned int present;
1971 1988
1972 present = snd_hda_codec_read(codec, 0x21, 0, 1989 present = snd_hda_codec_read(codec, 0x21, 0,
1973 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); 1990 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
1974 present &= HDA_AMP_VOLMASK; 1991 present &= HDA_AMP_VOLMASK;
@@ -2050,7 +2067,7 @@ static struct hda_verb alc880_pin_asus_init_verbs[] = {
2050 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 2067 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2051 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 2068 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2052 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 2069 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2053 2070
2054 { } 2071 { }
2055}; 2072};
2056 2073
@@ -2632,12 +2649,14 @@ static int alc_build_pcms(struct hda_codec *codec)
2632 2649
2633 info->name = spec->stream_name_analog; 2650 info->name = spec->stream_name_analog;
2634 if (spec->stream_analog_playback) { 2651 if (spec->stream_analog_playback) {
2635 snd_assert(spec->multiout.dac_nids, return -EINVAL); 2652 if (snd_BUG_ON(!spec->multiout.dac_nids))
2653 return -EINVAL;
2636 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); 2654 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2637 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; 2655 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2638 } 2656 }
2639 if (spec->stream_analog_capture) { 2657 if (spec->stream_analog_capture) {
2640 snd_assert(spec->adc_nids, return -EINVAL); 2658 if (snd_BUG_ON(!spec->adc_nids))
2659 return -EINVAL;
2641 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); 2660 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2642 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; 2661 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2643 } 2662 }
@@ -2667,6 +2686,8 @@ static int alc_build_pcms(struct hda_codec *codec)
2667 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); 2686 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2668 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; 2687 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2669 } 2688 }
2689 /* FIXME: do we need this for all Realtek codec models? */
2690 codec->spdif_status_reset = 1;
2670 } 2691 }
2671 2692
2672 /* If the use of more than one ADC is requested for the current 2693 /* If the use of more than one ADC is requested for the current
@@ -3683,7 +3704,7 @@ static void alc880_auto_init_multi_out(struct hda_codec *codec)
3683{ 3704{
3684 struct alc_spec *spec = codec->spec; 3705 struct alc_spec *spec = codec->spec;
3685 int i; 3706 int i;
3686 3707
3687 alc_subsystem_id(codec, 0x15, 0x1b, 0x14); 3708 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3688 for (i = 0; i < spec->autocfg.line_outs; i++) { 3709 for (i = 0; i < spec->autocfg.line_outs; i++) {
3689 hda_nid_t nid = spec->autocfg.line_out_pins[i]; 3710 hda_nid_t nid = spec->autocfg.line_out_pins[i];
@@ -4124,6 +4145,33 @@ static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4124 { } /* end */ 4145 { } /* end */
4125}; 4146};
4126 4147
4148static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4149 .ops = &snd_hda_bind_vol,
4150 .values = {
4151 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4152 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4153 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4154 0
4155 },
4156};
4157
4158static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4159 .ops = &snd_hda_bind_sw,
4160 .values = {
4161 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4162 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4163 0
4164 },
4165};
4166
4167static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4168 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4169 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4170 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4171 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4172 { } /* end */
4173};
4174
4127static struct hda_verb alc260_hp_3013_unsol_verbs[] = { 4175static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4128 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 4176 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4129 {}, 4177 {},
@@ -4147,7 +4195,30 @@ static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4147 alc260_hp_3013_automute(codec); 4195 alc260_hp_3013_automute(codec);
4148} 4196}
4149 4197
4150/* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, 4198static void alc260_hp_3012_automute(struct hda_codec *codec)
4199{
4200 unsigned int present, bits;
4201
4202 present = snd_hda_codec_read(codec, 0x10, 0,
4203 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4204
4205 bits = present ? 0 : PIN_OUT;
4206 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4207 bits);
4208 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4209 bits);
4210 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4211 bits);
4212}
4213
4214static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4215 unsigned int res)
4216{
4217 if ((res >> 26) == ALC880_HP_EVENT)
4218 alc260_hp_3012_automute(codec);
4219}
4220
4221/* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4151 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. 4222 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4152 */ 4223 */
4153static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { 4224static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
@@ -4478,7 +4549,7 @@ static struct hda_verb alc260_fujitsu_init_verbs[] = {
4478 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, 4549 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4479 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, 4550 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4480 4551
4481 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus 4552 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4482 * when acting as an output. 4553 * when acting as an output.
4483 */ 4554 */
4484 {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, 4555 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
@@ -4503,14 +4574,14 @@ static struct hda_verb alc260_fujitsu_init_verbs[] = {
4503 * stage. 4574 * stage.
4504 */ 4575 */
4505 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 4576 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4506 /* Unmute input buffer of pin widget used for Line-in (no equiv 4577 /* Unmute input buffer of pin widget used for Line-in (no equiv
4507 * mixer ctrl) 4578 * mixer ctrl)
4508 */ 4579 */
4509 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4580 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4510 4581
4511 /* Mute capture amp left and right */ 4582 /* Mute capture amp left and right */
4512 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4583 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4513 /* Set ADC connection select to match default mixer setting - line 4584 /* Set ADC connection select to match default mixer setting - line
4514 * in (on mic1 pin) 4585 * in (on mic1 pin)
4515 */ 4586 */
4516 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, 4587 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
@@ -4564,7 +4635,7 @@ static struct hda_verb alc260_acer_init_verbs[] = {
4564 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, 4635 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4565 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, 4636 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4566 4637
4567 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum 4638 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4568 * bus when acting as outputs. 4639 * bus when acting as outputs.
4569 */ 4640 */
4570 {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, 4641 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
@@ -4675,6 +4746,20 @@ static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4675 alc260_replacer_672v_automute(codec); 4746 alc260_replacer_672v_automute(codec);
4676} 4747}
4677 4748
4749static struct hda_verb alc260_hp_dc7600_verbs[] = {
4750 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
4751 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
4752 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4753 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4754 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4755 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4756 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4757 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4758 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4759 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4760 {}
4761};
4762
4678/* Test configuration for debugging, modelled after the ALC880 test 4763/* Test configuration for debugging, modelled after the ALC880 test
4679 * configuration. 4764 * configuration.
4680 */ 4765 */
@@ -4686,7 +4771,7 @@ static hda_nid_t alc260_test_adc_nids[2] = {
4686 0x04, 0x05, 4771 0x04, 0x05,
4687}; 4772};
4688/* For testing the ALC260, each input MUX needs its own definition since 4773/* For testing the ALC260, each input MUX needs its own definition since
4689 * the signal assignments are different. This assumes that the first ADC 4774 * the signal assignments are different. This assumes that the first ADC
4690 * is NID 0x04. 4775 * is NID 0x04.
4691 */ 4776 */
4692static struct hda_input_mux alc260_test_capture_sources[2] = { 4777static struct hda_input_mux alc260_test_capture_sources[2] = {
@@ -4769,7 +4854,7 @@ static struct snd_kcontrol_new alc260_test_mixer[] = {
4769 4854
4770 /* Switches to allow the digital IO pins to be enabled. The datasheet 4855 /* 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 4856 * is ambigious as to which NID is which; testing on laptops which
4772 * make this output available should provide clarification. 4857 * make this output available should provide clarification.
4773 */ 4858 */
4774 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), 4859 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4775 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), 4860 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
@@ -4805,7 +4890,7 @@ static struct hda_verb alc260_test_init_verbs[] = {
4805 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, 4890 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4806 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, 4891 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4807 4892
4808 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the 4893 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4809 * OUT1 sum bus when acting as an output. 4894 * OUT1 sum bus when acting as an output.
4810 */ 4895 */
4811 {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, 4896 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
@@ -4897,7 +4982,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); 4982 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4898 } else 4983 } else
4899 return 0; /* N/A */ 4984 return 0; /* N/A */
4900 4985
4901 snprintf(name, sizeof(name), "%s Playback Volume", pfx); 4986 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
4902 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); 4987 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
4903 if (err < 0) 4988 if (err < 0)
@@ -5003,7 +5088,7 @@ static void alc260_auto_init_multi_out(struct hda_codec *codec)
5003 int pin_type = get_pin_type(spec->autocfg.line_out_type); 5088 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5004 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); 5089 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5005 } 5090 }
5006 5091
5007 nid = spec->autocfg.speaker_pins[0]; 5092 nid = spec->autocfg.speaker_pins[0];
5008 if (nid) 5093 if (nid)
5009 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); 5094 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
@@ -5045,7 +5130,7 @@ static struct hda_verb alc260_volume_init_verbs[] = {
5045 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5130 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5046 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, 5131 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5047 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5132 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5048 5133
5049 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback 5134 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5050 * mixer widget 5135 * mixer widget
5051 * Note: PASD motherboards uses the Line In 2 as the input for 5136 * Note: PASD motherboards uses the Line In 2 as the input for
@@ -5074,7 +5159,7 @@ static struct hda_verb alc260_volume_init_verbs[] = {
5074 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5159 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5075 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5160 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5076 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5161 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5077 5162
5078 { } 5163 { }
5079}; 5164};
5080 5165
@@ -5155,6 +5240,7 @@ static const char *alc260_models[ALC260_MODEL_LAST] = {
5155 [ALC260_BASIC] = "basic", 5240 [ALC260_BASIC] = "basic",
5156 [ALC260_HP] = "hp", 5241 [ALC260_HP] = "hp",
5157 [ALC260_HP_3013] = "hp-3013", 5242 [ALC260_HP_3013] = "hp-3013",
5243 [ALC260_HP_DC7600] = "hp-dc7600",
5158 [ALC260_FUJITSU_S702X] = "fujitsu", 5244 [ALC260_FUJITSU_S702X] = "fujitsu",
5159 [ALC260_ACER] = "acer", 5245 [ALC260_ACER] = "acer",
5160 [ALC260_WILL] = "will", 5246 [ALC260_WILL] = "will",
@@ -5172,7 +5258,7 @@ static struct snd_pci_quirk alc260_cfg_tbl[] = {
5172 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), 5258 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5173 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), 5259 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5174 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), 5260 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5175 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), 5261 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5176 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), 5262 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5177 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), 5263 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5178 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), 5264 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
@@ -5218,6 +5304,22 @@ static struct alc_config_preset alc260_presets[] = {
5218 .unsol_event = alc260_hp_unsol_event, 5304 .unsol_event = alc260_hp_unsol_event,
5219 .init_hook = alc260_hp_automute, 5305 .init_hook = alc260_hp_automute,
5220 }, 5306 },
5307 [ALC260_HP_DC7600] = {
5308 .mixers = { alc260_hp_dc7600_mixer,
5309 alc260_input_mixer,
5310 alc260_capture_alt_mixer },
5311 .init_verbs = { alc260_init_verbs,
5312 alc260_hp_dc7600_verbs },
5313 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5314 .dac_nids = alc260_dac_nids,
5315 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5316 .adc_nids = alc260_hp_adc_nids,
5317 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5318 .channel_mode = alc260_modes,
5319 .input_mux = &alc260_capture_source,
5320 .unsol_event = alc260_hp_3012_unsol_event,
5321 .init_hook = alc260_hp_3012_automute,
5322 },
5221 [ALC260_HP_3013] = { 5323 [ALC260_HP_3013] = {
5222 .mixers = { alc260_hp_3013_mixer, 5324 .mixers = { alc260_hp_3013_mixer,
5223 alc260_input_mixer, 5325 alc260_input_mixer,
@@ -5933,7 +6035,7 @@ static struct hda_verb alc882_targa_verbs[] = {
5933 6035
5934 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 6036 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5935 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 6037 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5936 6038
5937 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ 6039 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5938 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ 6040 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5939 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 6041 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
@@ -5949,7 +6051,7 @@ static struct hda_verb alc882_targa_verbs[] = {
5949static void alc882_targa_automute(struct hda_codec *codec) 6051static void alc882_targa_automute(struct hda_codec *codec)
5950{ 6052{
5951 unsigned int present; 6053 unsigned int present;
5952 6054
5953 present = snd_hda_codec_read(codec, 0x14, 0, 6055 present = snd_hda_codec_read(codec, 0x14, 0,
5954 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 6056 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5955 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, 6057 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
@@ -5975,7 +6077,7 @@ static struct hda_verb alc882_asus_a7j_verbs[] = {
5975 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 6077 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5976 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 6078 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5977 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 6079 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5978 6080
5979 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ 6081 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5980 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 6082 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5981 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ 6083 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
@@ -5993,7 +6095,7 @@ static struct hda_verb alc882_asus_a7m_verbs[] = {
5993 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 6095 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5994 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 6096 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5995 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 6097 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5996 6098
5997 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ 6099 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5998 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 6100 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5999 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ 6101 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
@@ -6319,7 +6421,7 @@ static struct alc_config_preset alc882_presets[] = {
6319 .channel_mode = alc882_3ST_6ch_modes, 6421 .channel_mode = alc882_3ST_6ch_modes,
6320 .need_dac_fix = 1, 6422 .need_dac_fix = 1,
6321 .input_mux = &alc882_capture_source, 6423 .input_mux = &alc882_capture_source,
6322 }, 6424 },
6323 [ALC882_ASUS_A7M] = { 6425 [ALC882_ASUS_A7M] = {
6324 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, 6426 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6325 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, 6427 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
@@ -6332,14 +6434,14 @@ static struct alc_config_preset alc882_presets[] = {
6332 .channel_mode = alc880_threestack_modes, 6434 .channel_mode = alc880_threestack_modes,
6333 .need_dac_fix = 1, 6435 .need_dac_fix = 1,
6334 .input_mux = &alc882_capture_source, 6436 .input_mux = &alc882_capture_source,
6335 }, 6437 },
6336}; 6438};
6337 6439
6338 6440
6339/* 6441/*
6340 * Pin config fixes 6442 * Pin config fixes
6341 */ 6443 */
6342enum { 6444enum {
6343 PINFIX_ABIT_AW9D_MAX 6445 PINFIX_ABIT_AW9D_MAX
6344}; 6446};
6345 6447
@@ -6554,16 +6656,19 @@ static int patch_alc882(struct hda_codec *codec)
6554 board_config = ALC885_MACPRO; 6656 board_config = ALC885_MACPRO;
6555 break; 6657 break;
6556 case 0x106b1000: /* iMac 24 */ 6658 case 0x106b1000: /* iMac 24 */
6659 case 0x106b2800: /* AppleTV */
6557 board_config = ALC885_IMAC24; 6660 board_config = ALC885_IMAC24;
6558 break; 6661 break;
6559 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ 6662 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
6663 case 0x106b00a4: /* MacbookPro4,1 */
6560 case 0x106b2c00: /* Macbook Pro rev3 */ 6664 case 0x106b2c00: /* Macbook Pro rev3 */
6561 case 0x106b3600: /* Macbook 3.1 */ 6665 case 0x106b3600: /* Macbook 3.1 */
6562 board_config = ALC885_MBP3; 6666 board_config = ALC885_MBP3;
6563 break; 6667 break;
6564 default: 6668 default:
6565 /* ALC889A is handled better as ALC888-compatible */ 6669 /* ALC889A is handled better as ALC888-compatible */
6566 if (codec->revision_id == 0x100103) { 6670 if (codec->revision_id == 0x100101 ||
6671 codec->revision_id == 0x100103) {
6567 alc_free(codec); 6672 alc_free(codec);
6568 return patch_alc883(codec); 6673 return patch_alc883(codec);
6569 } 6674 }
@@ -6718,6 +6823,23 @@ static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6718 }, 6823 },
6719}; 6824};
6720 6825
6826static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6827 .num_items = 3,
6828 .items = {
6829 { "Mic", 0x0 },
6830 { "Front Mic", 0x1 },
6831 { "Line", 0x4 },
6832 },
6833};
6834
6835static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6836 .num_items = 2,
6837 .items = {
6838 { "Mic", 0x0 },
6839 { "Line", 0x2 },
6840 },
6841};
6842
6721#define alc883_mux_enum_info alc_mux_enum_info 6843#define alc883_mux_enum_info alc_mux_enum_info
6722#define alc883_mux_enum_get alc_mux_enum_get 6844#define alc883_mux_enum_get alc_mux_enum_get
6723/* ALC883 has the ALC882-type input selection */ 6845/* ALC883 has the ALC882-type input selection */
@@ -7032,13 +7154,11 @@ static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7032 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), 7154 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7033 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 7155 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7034 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 7156 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 { 7157 {
7038 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 7158 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7039 /* .name = "Capture Source", */ 7159 /* .name = "Capture Source", */
7040 .name = "Input Source", 7160 .name = "Input Source",
7041 .count = 2, 7161 .count = 1,
7042 .info = alc883_mux_enum_info, 7162 .info = alc883_mux_enum_info,
7043 .get = alc883_mux_enum_get, 7163 .get = alc883_mux_enum_get,
7044 .put = alc883_mux_enum_put, 7164 .put = alc883_mux_enum_put,
@@ -7256,7 +7376,7 @@ static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7256 .put = alc883_mux_enum_put, 7376 .put = alc883_mux_enum_put,
7257 }, 7377 },
7258 { } /* end */ 7378 { } /* end */
7259}; 7379};
7260 7380
7261static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { 7381static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7262 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 7382 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
@@ -7283,6 +7403,87 @@ static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7283 { } /* end */ 7403 { } /* end */
7284}; 7404};
7285 7405
7406static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7407 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7408 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7409 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7410 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7411 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7412 0x0d, 1, 0x0, HDA_OUTPUT),
7413 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7414 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7415 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7416 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7417 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7418 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7419 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7420 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7421 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7422 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7423 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7424 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7425 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7426 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7427 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7428 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7429 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7430 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7431 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7432 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7433 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7434 {
7435 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7436 /* .name = "Capture Source", */
7437 .name = "Input Source",
7438 .count = 2,
7439 .info = alc883_mux_enum_info,
7440 .get = alc883_mux_enum_get,
7441 .put = alc883_mux_enum_put,
7442 },
7443 { } /* end */
7444};
7445
7446static struct hda_bind_ctls alc883_bind_cap_vol = {
7447 .ops = &snd_hda_bind_vol,
7448 .values = {
7449 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7450 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7451 0
7452 },
7453};
7454
7455static struct hda_bind_ctls alc883_bind_cap_switch = {
7456 .ops = &snd_hda_bind_sw,
7457 .values = {
7458 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7459 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7460 0
7461 },
7462};
7463
7464static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7465 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7466 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7467 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7468 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7469 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7470 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7471 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7472 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7473 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7474 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7475 {
7476 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7477 /* .name = "Capture Source", */
7478 .name = "Input Source",
7479 .count = 1,
7480 .info = alc883_mux_enum_info,
7481 .get = alc883_mux_enum_get,
7482 .put = alc883_mux_enum_put,
7483 },
7484 { } /* end */
7485};
7486
7286static struct snd_kcontrol_new alc883_chmode_mixer[] = { 7487static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7287 { 7488 {
7288 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 7489 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -7296,7 +7497,7 @@ static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7296 7497
7297static struct hda_verb alc883_init_verbs[] = { 7498static struct hda_verb alc883_init_verbs[] = {
7298 /* ADC1: mute amp left and right */ 7499 /* ADC1: mute amp left and right */
7299 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 7500 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7300 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 7501 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7301 /* ADC2: mute amp left and right */ 7502 /* ADC2: mute amp left and right */
7302 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 7503 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
@@ -7361,14 +7562,14 @@ static struct hda_verb alc883_init_verbs[] = {
7361 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ 7562 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7362 /* Input mixer2 */ 7563 /* Input mixer2 */
7363 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7564 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7364 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7565 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7365 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 7566 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7366 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, 7567 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7367 /* Input mixer3 */ 7568 /* Input mixer3 */
7368 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7569 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7369 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7570 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7370 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 7571 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7371 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, 7572 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7372 { } 7573 { }
7373}; 7574};
7374 7575
@@ -7468,7 +7669,7 @@ static struct hda_verb alc883_tagra_verbs[] = {
7468 7669
7469 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 7670 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7470 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 7671 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7471 7672
7472 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ 7673 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7473 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ 7674 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7474 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 7675 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
@@ -7518,6 +7719,18 @@ static struct hda_verb alc883_haier_w66_verbs[] = {
7518 { } /* end */ 7719 { } /* end */
7519}; 7720};
7520 7721
7722static struct hda_verb alc888_lenovo_sky_verbs[] = {
7723 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7724 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7725 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7726 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7727 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7728 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7729 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7730 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7731 { } /* end */
7732};
7733
7521static struct hda_verb alc888_3st_hp_verbs[] = { 7734static struct hda_verb alc888_3st_hp_verbs[] = {
7522 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ 7735 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7523 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ 7736 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
@@ -7555,7 +7768,7 @@ static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7555static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) 7768static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7556{ 7769{
7557 unsigned int present; 7770 unsigned int present;
7558 7771
7559 present = snd_hda_codec_read(codec, 0x1b, 0, 7772 present = snd_hda_codec_read(codec, 0x1b, 0,
7560 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 7773 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7561 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 7774 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
@@ -7568,7 +7781,7 @@ static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7568static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) 7781static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7569{ 7782{
7570 unsigned int present; 7783 unsigned int present;
7571 7784
7572 present = snd_hda_codec_read(codec, 0x14, 0, 7785 present = snd_hda_codec_read(codec, 0x14, 0,
7573 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 7786 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7574 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, 7787 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
@@ -7598,7 +7811,7 @@ static struct hda_verb alc883_medion_md2_verbs[] = {
7598static void alc883_medion_md2_automute(struct hda_codec *codec) 7811static void alc883_medion_md2_automute(struct hda_codec *codec)
7599{ 7812{
7600 unsigned int present; 7813 unsigned int present;
7601 7814
7602 present = snd_hda_codec_read(codec, 0x14, 0, 7815 present = snd_hda_codec_read(codec, 0x14, 0,
7603 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 7816 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7604 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, 7817 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
@@ -7753,7 +7966,7 @@ static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
7753static void alc883_acer_aspire_automute(struct hda_codec *codec) 7966static void alc883_acer_aspire_automute(struct hda_codec *codec)
7754{ 7967{
7755 unsigned int present; 7968 unsigned int present;
7756 7969
7757 present = snd_hda_codec_read(codec, 0x14, 0, 7970 present = snd_hda_codec_read(codec, 0x14, 0,
7758 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 7971 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7759 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, 7972 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
@@ -7790,7 +8003,7 @@ static struct hda_verb alc883_acer_eapd_verbs[] = {
7790static void alc888_6st_dell_front_automute(struct hda_codec *codec) 8003static void alc888_6st_dell_front_automute(struct hda_codec *codec)
7791{ 8004{
7792 unsigned int present; 8005 unsigned int present;
7793 8006
7794 present = snd_hda_codec_read(codec, 0x1b, 0, 8007 present = snd_hda_codec_read(codec, 0x1b, 0,
7795 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 8008 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7796 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 8009 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
@@ -7814,6 +8027,50 @@ static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
7814 } 8027 }
7815} 8028}
7816 8029
8030static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
8031{
8032 unsigned int mute;
8033 unsigned int present;
8034
8035 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8036 present = snd_hda_codec_read(codec, 0x1b, 0,
8037 AC_VERB_GET_PIN_SENSE, 0);
8038 present = (present & 0x80000000) != 0;
8039 if (present) {
8040 /* mute internal speaker */
8041 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8042 HDA_AMP_MUTE, HDA_AMP_MUTE);
8043 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8044 HDA_AMP_MUTE, HDA_AMP_MUTE);
8045 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8046 HDA_AMP_MUTE, HDA_AMP_MUTE);
8047 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8048 HDA_AMP_MUTE, HDA_AMP_MUTE);
8049 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8050 HDA_AMP_MUTE, HDA_AMP_MUTE);
8051 } else {
8052 /* unmute internal speaker if necessary */
8053 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8054 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8055 HDA_AMP_MUTE, mute);
8056 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8057 HDA_AMP_MUTE, mute);
8058 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8059 HDA_AMP_MUTE, mute);
8060 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8061 HDA_AMP_MUTE, mute);
8062 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8063 HDA_AMP_MUTE, mute);
8064 }
8065}
8066
8067static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
8068 unsigned int res)
8069{
8070 if ((res >> 26) == ALC880_HP_EVENT)
8071 alc888_lenovo_sky_front_automute(codec);
8072}
8073
7817/* 8074/*
7818 * generic initialization of ADC, input mixers and output mixers 8075 * generic initialization of ADC, input mixers and output mixers
7819 */ 8076 */
@@ -7898,6 +8155,105 @@ static struct snd_kcontrol_new alc883_capture_mixer[] = {
7898 { } /* end */ 8155 { } /* end */
7899}; 8156};
7900 8157
8158static struct hda_verb alc888_asus_m90v_verbs[] = {
8159 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8160 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8161 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8162 /* enable unsolicited event */
8163 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8164 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8165 { } /* end */
8166};
8167
8168static void alc883_nb_mic_automute(struct hda_codec *codec)
8169{
8170 unsigned int present;
8171
8172 present = snd_hda_codec_read(codec, 0x18, 0,
8173 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8174 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8175 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8176 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8177 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8178}
8179
8180static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8181{
8182 unsigned int present;
8183 unsigned char bits;
8184
8185 present = snd_hda_codec_read(codec, 0x1b, 0,
8186 AC_VERB_GET_PIN_SENSE, 0)
8187 & AC_PINSENSE_PRESENCE;
8188 bits = present ? 0 : PIN_OUT;
8189 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8190 bits);
8191 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8192 bits);
8193 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8194 bits);
8195}
8196
8197static void alc883_mode2_unsol_event(struct hda_codec *codec,
8198 unsigned int res)
8199{
8200 switch (res >> 26) {
8201 case ALC880_HP_EVENT:
8202 alc883_M90V_speaker_automute(codec);
8203 break;
8204 case ALC880_MIC_EVENT:
8205 alc883_nb_mic_automute(codec);
8206 break;
8207 }
8208}
8209
8210static void alc883_mode2_inithook(struct hda_codec *codec)
8211{
8212 alc883_M90V_speaker_automute(codec);
8213 alc883_nb_mic_automute(codec);
8214}
8215
8216static struct hda_verb alc888_asus_eee1601_verbs[] = {
8217 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8218 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8219 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8220 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8221 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8222 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8223 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8224 /* enable unsolicited event */
8225 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8226 { } /* end */
8227};
8228
8229static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8230{
8231 unsigned int present;
8232 unsigned char bits;
8233
8234 present = snd_hda_codec_read(codec, 0x14, 0,
8235 AC_VERB_GET_PIN_SENSE, 0)
8236 & AC_PINSENSE_PRESENCE;
8237 bits = present ? 0 : PIN_OUT;
8238 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8239 bits);
8240}
8241
8242static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8243 unsigned int res)
8244{
8245 switch (res >> 26) {
8246 case ALC880_HP_EVENT:
8247 alc883_eee1601_speaker_automute(codec);
8248 break;
8249 }
8250}
8251
8252static void alc883_eee1601_inithook(struct hda_codec *codec)
8253{
8254 alc883_eee1601_speaker_automute(codec);
8255}
8256
7901#ifdef CONFIG_SND_HDA_POWER_SAVE 8257#ifdef CONFIG_SND_HDA_POWER_SAVE
7902#define alc883_loopbacks alc880_loopbacks 8258#define alc883_loopbacks alc880_loopbacks
7903#endif 8259#endif
@@ -7927,6 +8283,7 @@ static const char *alc883_models[ALC883_MODEL_LAST] = {
7927 [ALC883_LENOVO_101E_2ch] = "lenovo-101e", 8283 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
7928 [ALC883_LENOVO_NB0763] = "lenovo-nb0763", 8284 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
7929 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", 8285 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8286 [ALC888_LENOVO_SKY] = "lenovo-sky",
7930 [ALC883_HAIER_W66] = "haier-w66", 8287 [ALC883_HAIER_W66] = "haier-w66",
7931 [ALC888_3ST_HP] = "3stack-hp", 8288 [ALC888_3ST_HP] = "3stack-hp",
7932 [ALC888_6ST_DELL] = "6stack-dell", 8289 [ALC888_6ST_DELL] = "6stack-dell",
@@ -7942,7 +8299,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
7942 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), 8299 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
7943 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), 8300 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
7944 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), 8301 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
7945 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), 8302 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
7946 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ 8303 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
7947 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), 8304 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
7948 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), 8305 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
@@ -7950,10 +8307,13 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
7950 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), 8307 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
7951 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), 8308 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
7952 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), 8309 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8310 SND_PCI_QUIRK(0x1043, 0x8317, "Asus M90V", ALC888_ASUS_M90V),
8311 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
7953 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), 8312 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
7954 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), 8313 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
7955 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), 8314 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
7956 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), 8315 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8316 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
7957 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), 8317 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
7958 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), 8318 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
7959 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), 8319 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
@@ -7989,6 +8349,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
7989 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), 8349 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7990 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), 8350 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7991 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), 8351 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8352 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
7992 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), 8353 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
7993 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), 8354 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
7994 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), 8355 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
@@ -8128,7 +8489,7 @@ static struct alc_config_preset alc883_presets[] = {
8128 .input_mux = &alc883_capture_source, 8489 .input_mux = &alc883_capture_source,
8129 .unsol_event = alc883_medion_md2_unsol_event, 8490 .unsol_event = alc883_medion_md2_unsol_event,
8130 .init_hook = alc883_medion_md2_automute, 8491 .init_hook = alc883_medion_md2_automute,
8131 }, 8492 },
8132 [ALC883_LAPTOP_EAPD] = { 8493 [ALC883_LAPTOP_EAPD] = {
8133 .mixers = { alc883_base_mixer }, 8494 .mixers = { alc883_base_mixer },
8134 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, 8495 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
@@ -8245,6 +8606,49 @@ static struct alc_config_preset alc883_presets[] = {
8245 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, 8606 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8246 .init_hook = alc883_2ch_fujitsu_pi2515_automute, 8607 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8247 }, 8608 },
8609 [ALC888_LENOVO_SKY] = {
8610 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
8611 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
8612 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8613 .dac_nids = alc883_dac_nids,
8614 .dig_out_nid = ALC883_DIGOUT_NID,
8615 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
8616 .adc_nids = alc883_adc_nids,
8617 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8618 .channel_mode = alc883_sixstack_modes,
8619 .need_dac_fix = 1,
8620 .input_mux = &alc883_lenovo_sky_capture_source,
8621 .unsol_event = alc883_lenovo_sky_unsol_event,
8622 .init_hook = alc888_lenovo_sky_front_automute,
8623 },
8624 [ALC888_ASUS_M90V] = {
8625 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8626 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
8627 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8628 .dac_nids = alc883_dac_nids,
8629 .dig_out_nid = ALC883_DIGOUT_NID,
8630 .dig_in_nid = ALC883_DIGIN_NID,
8631 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8632 .channel_mode = alc883_3ST_6ch_modes,
8633 .need_dac_fix = 1,
8634 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8635 .unsol_event = alc883_mode2_unsol_event,
8636 .init_hook = alc883_mode2_inithook,
8637 },
8638 [ALC888_ASUS_EEE1601] = {
8639 .mixers = { alc883_asus_eee1601_mixer },
8640 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
8641 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8642 .dac_nids = alc883_dac_nids,
8643 .dig_out_nid = ALC883_DIGOUT_NID,
8644 .dig_in_nid = ALC883_DIGIN_NID,
8645 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8646 .channel_mode = alc883_3ST_2ch_modes,
8647 .need_dac_fix = 1,
8648 .input_mux = &alc883_asus_eee1601_capture_source,
8649 .unsol_event = alc883_eee1601_unsol_event,
8650 .init_hook = alc883_eee1601_inithook,
8651 },
8248}; 8652};
8249 8653
8250 8654
@@ -8452,6 +8856,13 @@ static int patch_alc883(struct hda_codec *codec)
8452#define alc262_modes alc260_modes 8856#define alc262_modes alc260_modes
8453#define alc262_capture_source alc882_capture_source 8857#define alc262_capture_source alc882_capture_source
8454 8858
8859static hda_nid_t alc262_dmic_adc_nids[1] = {
8860 /* ADC0 */
8861 0x09
8862};
8863
8864static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
8865
8455static struct snd_kcontrol_new alc262_base_mixer[] = { 8866static struct snd_kcontrol_new alc262_base_mixer[] = {
8456 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 8867 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8457 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), 8868 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
@@ -8833,10 +9244,10 @@ static struct hda_verb alc262_init_verbs[] = {
8833 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, 9244 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8834 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, 9245 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8835 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, 9246 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8836 9247
8837 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, 9248 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8838 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, 9249 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8839 9250
8840 /* FIXME: use matrix-type input source selection */ 9251 /* FIXME: use matrix-type input source selection */
8841 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ 9252 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8842 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ 9253 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
@@ -8858,6 +9269,12 @@ static struct hda_verb alc262_init_verbs[] = {
8858 { } 9269 { }
8859}; 9270};
8860 9271
9272static struct hda_verb alc262_eapd_verbs[] = {
9273 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9274 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9275 { }
9276};
9277
8861static struct hda_verb alc262_hippo_unsol_verbs[] = { 9278static struct hda_verb alc262_hippo_unsol_verbs[] = {
8862 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 9279 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8863 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 9280 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
@@ -8884,6 +9301,91 @@ static struct hda_verb alc262_sony_unsol_verbs[] = {
8884 {} 9301 {}
8885}; 9302};
8886 9303
9304static struct hda_input_mux alc262_dmic_capture_source = {
9305 .num_items = 2,
9306 .items = {
9307 { "Int DMic", 0x9 },
9308 { "Mic", 0x0 },
9309 },
9310};
9311
9312static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9313 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9314 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9315 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9316 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9317 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9318 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
9319 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
9320 {
9321 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9322 /* The multiple "Capture Source" controls confuse alsamixer
9323 * So call somewhat different..
9324 */
9325 /* .name = "Capture Source", */
9326 .name = "Input Source",
9327 .count = 1,
9328 .info = alc_mux_enum_info,
9329 .get = alc_mux_enum_get,
9330 .put = alc_mux_enum_put,
9331 },
9332 { } /* end */
9333};
9334
9335static struct hda_verb alc262_toshiba_s06_verbs[] = {
9336 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9337 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9338 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9339 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9340 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9341 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9342 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9343 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9344 {}
9345};
9346
9347static void alc262_dmic_automute(struct hda_codec *codec)
9348{
9349 unsigned int present;
9350
9351 present = snd_hda_codec_read(codec, 0x18, 0,
9352 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9353 snd_hda_codec_write(codec, 0x22, 0,
9354 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9355}
9356
9357/* toggle speaker-output according to the hp-jack state */
9358static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9359{
9360 unsigned int present;
9361 unsigned char bits;
9362
9363 present = snd_hda_codec_read(codec, 0x15, 0,
9364 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9365 bits = present ? 0 : PIN_OUT;
9366 snd_hda_codec_write(codec, 0x14, 0,
9367 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9368}
9369
9370
9371
9372/* unsolicited event for HP jack sensing */
9373static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9374 unsigned int res)
9375{
9376 if ((res >> 26) == ALC880_HP_EVENT)
9377 alc262_toshiba_s06_speaker_automute(codec);
9378 if ((res >> 26) == ALC880_MIC_EVENT)
9379 alc262_dmic_automute(codec);
9380
9381}
9382
9383static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9384{
9385 alc262_toshiba_s06_speaker_automute(codec);
9386 alc262_dmic_automute(codec);
9387}
9388
8887/* mute/unmute internal speaker according to the hp jack and mute state */ 9389/* mute/unmute internal speaker according to the hp jack and mute state */
8888static void alc262_hippo_automute(struct hda_codec *codec) 9390static void alc262_hippo_automute(struct hda_codec *codec)
8889{ 9391{
@@ -8948,6 +9450,41 @@ static void alc262_hippo1_unsol_event(struct hda_codec *codec,
8948} 9450}
8949 9451
8950/* 9452/*
9453 * nec model
9454 * 0x15 = headphone
9455 * 0x16 = internal speaker
9456 * 0x18 = external mic
9457 */
9458
9459static struct snd_kcontrol_new alc262_nec_mixer[] = {
9460 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9461 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9462
9463 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9464 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9465 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9466
9467 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9468 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9469 { } /* end */
9470};
9471
9472static struct hda_verb alc262_nec_verbs[] = {
9473 /* Unmute Speaker */
9474 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9475
9476 /* Headphone */
9477 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9478 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9479
9480 /* External mic to headphone */
9481 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9482 /* External mic to speaker */
9483 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9484 {}
9485};
9486
9487/*
8951 * fujitsu model 9488 * fujitsu model
8952 * 0x14 = headphone/spdif-out, 0x15 = internal speaker, 9489 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
8953 * 0x1b = port replicator headphone out 9490 * 0x1b = port replicator headphone out
@@ -9179,6 +9716,25 @@ static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
9179 { } /* end */ 9716 { } /* end */
9180}; 9717};
9181 9718
9719static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
9720 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9721 {
9722 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9723 .name = "Master Playback Switch",
9724 .info = snd_hda_mixer_amp_switch_info,
9725 .get = snd_hda_mixer_amp_switch_get,
9726 .put = alc262_sony_master_sw_put,
9727 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9728 },
9729 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9730 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9731 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9732 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9733 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9734 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9735 { } /* end */
9736};
9737
9182/* additional init verbs for Benq laptops */ 9738/* additional init verbs for Benq laptops */
9183static struct hda_verb alc262_EAPD_verbs[] = { 9739static struct hda_verb alc262_EAPD_verbs[] = {
9184 {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, 9740 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
@@ -9427,7 +9983,7 @@ static struct hda_verb alc262_volume_init_verbs[] = {
9427 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 9983 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9428 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 9984 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9429 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 9985 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9430 9986
9431 /* set up input amps for analog loopback */ 9987 /* set up input amps for analog loopback */
9432 /* Amp Indices: DAC = 0, mixer = 1 */ 9988 /* Amp Indices: DAC = 0, mixer = 1 */
9433 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 9989 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
@@ -9482,7 +10038,7 @@ static struct hda_verb alc262_HP_BPC_init_verbs[] = {
9482 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 10038 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9483 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, 10039 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9484 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, 10040 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9485 10041
9486 /* 10042 /*
9487 * Set up output mixers (0x0c - 0x0e) 10043 * Set up output mixers (0x0c - 0x0e)
9488 */ 10044 */
@@ -9643,6 +10199,24 @@ static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
9643 { } 10199 { }
9644}; 10200};
9645 10201
10202static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10203
10204 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10205 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10206 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10207
10208 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10209 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10210 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10211 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10212
10213 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10214 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10215 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10216 {}
10217};
10218
10219
9646#ifdef CONFIG_SND_HDA_POWER_SAVE 10220#ifdef CONFIG_SND_HDA_POWER_SAVE
9647#define alc262_loopbacks alc880_loopbacks 10221#define alc262_loopbacks alc880_loopbacks
9648#endif 10222#endif
@@ -9729,13 +10303,17 @@ static const char *alc262_models[ALC262_MODEL_LAST] = {
9729 [ALC262_BENQ_ED8] = "benq", 10303 [ALC262_BENQ_ED8] = "benq",
9730 [ALC262_BENQ_T31] = "benq-t31", 10304 [ALC262_BENQ_T31] = "benq-t31",
9731 [ALC262_SONY_ASSAMD] = "sony-assamd", 10305 [ALC262_SONY_ASSAMD] = "sony-assamd",
10306 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10307 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
9732 [ALC262_ULTRA] = "ultra", 10308 [ALC262_ULTRA] = "ultra",
9733 [ALC262_LENOVO_3000] = "lenovo-3000", 10309 [ALC262_LENOVO_3000] = "lenovo-3000",
10310 [ALC262_NEC] = "nec",
9734 [ALC262_AUTO] = "auto", 10311 [ALC262_AUTO] = "auto",
9735}; 10312};
9736 10313
9737static struct snd_pci_quirk alc262_cfg_tbl[] = { 10314static struct snd_pci_quirk alc262_cfg_tbl[] = {
9738 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), 10315 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10316 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
9739 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), 10317 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
9740 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), 10318 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
9741 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), 10319 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
@@ -9764,7 +10342,8 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = {
9764 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), 10342 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9765 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), 10343 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
9766 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", 10344 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
9767 ALC262_SONY_ASSAMD), 10345 ALC262_TOSHIBA_RX1),
10346 SND_PCI_QUIRK(0x1179, 0x0268, "Toshiba S06", ALC262_TOSHIBA_S06),
9768 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), 10347 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
9769 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), 10348 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
9770 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), 10349 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
@@ -9918,7 +10497,7 @@ static struct alc_config_preset alc262_presets[] = {
9918 .input_mux = &alc262_capture_source, 10497 .input_mux = &alc262_capture_source,
9919 .unsol_event = alc262_hippo_unsol_event, 10498 .unsol_event = alc262_hippo_unsol_event,
9920 .init_hook = alc262_hippo_automute, 10499 .init_hook = alc262_hippo_automute,
9921 }, 10500 },
9922 [ALC262_ULTRA] = { 10501 [ALC262_ULTRA] = {
9923 .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer }, 10502 .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer },
9924 .init_verbs = { alc262_ultra_verbs }, 10503 .init_verbs = { alc262_ultra_verbs },
@@ -9946,6 +10525,43 @@ static struct alc_config_preset alc262_presets[] = {
9946 .input_mux = &alc262_fujitsu_capture_source, 10525 .input_mux = &alc262_fujitsu_capture_source,
9947 .unsol_event = alc262_lenovo_3000_unsol_event, 10526 .unsol_event = alc262_lenovo_3000_unsol_event,
9948 }, 10527 },
10528 [ALC262_NEC] = {
10529 .mixers = { alc262_nec_mixer },
10530 .init_verbs = { alc262_nec_verbs },
10531 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10532 .dac_nids = alc262_dac_nids,
10533 .hp_nid = 0x03,
10534 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10535 .channel_mode = alc262_modes,
10536 .input_mux = &alc262_capture_source,
10537 },
10538 [ALC262_TOSHIBA_S06] = {
10539 .mixers = { alc262_toshiba_s06_mixer },
10540 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
10541 alc262_eapd_verbs },
10542 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10543 .capsrc_nids = alc262_dmic_capsrc_nids,
10544 .dac_nids = alc262_dac_nids,
10545 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
10546 .dig_out_nid = ALC262_DIGOUT_NID,
10547 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10548 .channel_mode = alc262_modes,
10549 .input_mux = &alc262_dmic_capture_source,
10550 .unsol_event = alc262_toshiba_s06_unsol_event,
10551 .init_hook = alc262_toshiba_s06_init_hook,
10552 },
10553 [ALC262_TOSHIBA_RX1] = {
10554 .mixers = { alc262_toshiba_rx1_mixer },
10555 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
10556 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10557 .dac_nids = alc262_dac_nids,
10558 .hp_nid = 0x03,
10559 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10560 .channel_mode = alc262_modes,
10561 .input_mux = &alc262_capture_source,
10562 .unsol_event = alc262_hippo_unsol_event,
10563 .init_hook = alc262_hippo_automute,
10564 },
9949}; 10565};
9950 10566
9951static int patch_alc262(struct hda_codec *codec) 10567static int patch_alc262(struct hda_codec *codec)
@@ -10004,7 +10620,7 @@ static int patch_alc262(struct hda_codec *codec)
10004 spec->stream_name_analog = "ALC262 Analog"; 10620 spec->stream_name_analog = "ALC262 Analog";
10005 spec->stream_analog_playback = &alc262_pcm_analog_playback; 10621 spec->stream_analog_playback = &alc262_pcm_analog_playback;
10006 spec->stream_analog_capture = &alc262_pcm_analog_capture; 10622 spec->stream_analog_capture = &alc262_pcm_analog_capture;
10007 10623
10008 spec->stream_name_digital = "ALC262 Digital"; 10624 spec->stream_name_digital = "ALC262 Digital";
10009 spec->stream_digital_playback = &alc262_pcm_digital_playback; 10625 spec->stream_digital_playback = &alc262_pcm_digital_playback;
10010 spec->stream_digital_capture = &alc262_pcm_digital_capture; 10626 spec->stream_digital_capture = &alc262_pcm_digital_capture;
@@ -10040,7 +10656,7 @@ static int patch_alc262(struct hda_codec *codec)
10040 if (!spec->loopback.amplist) 10656 if (!spec->loopback.amplist)
10041 spec->loopback.amplist = alc262_loopbacks; 10657 spec->loopback.amplist = alc262_loopbacks;
10042#endif 10658#endif
10043 10659
10044 return 0; 10660 return 0;
10045} 10661}
10046 10662
@@ -10049,7 +10665,7 @@ static int patch_alc262(struct hda_codec *codec)
10049 */ 10665 */
10050#define ALC268_DIGOUT_NID ALC880_DIGOUT_NID 10666#define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10051#define alc268_modes alc260_modes 10667#define alc268_modes alc260_modes
10052 10668
10053static hda_nid_t alc268_dac_nids[2] = { 10669static hda_nid_t alc268_dac_nids[2] = {
10054 /* front, hp */ 10670 /* front, hp */
10055 0x02, 0x03 10671 0x02, 0x03
@@ -10109,6 +10725,14 @@ static struct hda_verb alc268_toshiba_verbs[] = {
10109 { } /* end */ 10725 { } /* end */
10110}; 10726};
10111 10727
10728static struct hda_input_mux alc268_acer_lc_capture_source = {
10729 .num_items = 2,
10730 .items = {
10731 { "i-Mic", 0x6 },
10732 { "E-Mic", 0x0 },
10733 },
10734};
10735
10112/* Acer specific */ 10736/* Acer specific */
10113/* bind volumes of both NID 0x02 and 0x03 */ 10737/* bind volumes of both NID 0x02 and 0x03 */
10114static struct hda_bind_ctls alc268_acer_bind_master_vol = { 10738static struct hda_bind_ctls alc268_acer_bind_master_vol = {
@@ -10161,6 +10785,21 @@ static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
10161 return change; 10785 return change;
10162} 10786}
10163 10787
10788static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
10789 /* output mixer control */
10790 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10791 {
10792 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10793 .name = "Master Playback Switch",
10794 .info = snd_hda_mixer_amp_switch_info,
10795 .get = snd_hda_mixer_amp_switch_get,
10796 .put = alc268_acer_master_sw_put,
10797 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10798 },
10799 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
10800 { }
10801};
10802
10164static struct snd_kcontrol_new alc268_acer_mixer[] = { 10803static struct snd_kcontrol_new alc268_acer_mixer[] = {
10165 /* output mixer control */ 10804 /* output mixer control */
10166 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), 10805 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
@@ -10178,6 +10817,16 @@ static struct snd_kcontrol_new alc268_acer_mixer[] = {
10178 { } 10817 { }
10179}; 10818};
10180 10819
10820static struct hda_verb alc268_acer_aspire_one_verbs[] = {
10821 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10822 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10823 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10824 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10825 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
10826 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
10827 { }
10828};
10829
10181static struct hda_verb alc268_acer_verbs[] = { 10830static struct hda_verb alc268_acer_verbs[] = {
10182 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ 10831 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
10183 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 10832 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
@@ -10185,7 +10834,6 @@ static struct hda_verb alc268_acer_verbs[] = {
10185 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 10834 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10186 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 10835 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10187 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 10836 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10188
10189 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 10837 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10190 { } 10838 { }
10191}; 10839};
@@ -10212,6 +10860,47 @@ static void alc268_acer_init_hook(struct hda_codec *codec)
10212 alc268_acer_automute(codec, 1); 10860 alc268_acer_automute(codec, 1);
10213} 10861}
10214 10862
10863/* toggle speaker-output according to the hp-jack state */
10864static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
10865{
10866 unsigned int present;
10867 unsigned char bits;
10868
10869 present = snd_hda_codec_read(codec, 0x15, 0,
10870 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10871 bits = present ? AMP_IN_MUTE(0) : 0;
10872 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
10873 AMP_IN_MUTE(0), bits);
10874 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
10875 AMP_IN_MUTE(0), bits);
10876}
10877
10878
10879static void alc268_acer_mic_automute(struct hda_codec *codec)
10880{
10881 unsigned int present;
10882
10883 present = snd_hda_codec_read(codec, 0x18, 0,
10884 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10885 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
10886 present ? 0x0 : 0x6);
10887}
10888
10889static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
10890 unsigned int res)
10891{
10892 if ((res >> 26) == ALC880_HP_EVENT)
10893 alc268_aspire_one_speaker_automute(codec);
10894 if ((res >> 26) == ALC880_MIC_EVENT)
10895 alc268_acer_mic_automute(codec);
10896}
10897
10898static void alc268_acer_lc_init_hook(struct hda_codec *codec)
10899{
10900 alc268_aspire_one_speaker_automute(codec);
10901 alc268_acer_mic_automute(codec);
10902}
10903
10215static struct snd_kcontrol_new alc268_dell_mixer[] = { 10904static struct snd_kcontrol_new alc268_dell_mixer[] = {
10216 /* output mixer control */ 10905 /* output mixer control */
10217 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), 10906 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
@@ -10360,7 +11049,7 @@ static struct hda_verb alc268_base_init_verbs[] = {
10360 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 11049 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10361 11050
10362 /* Unmute Selector 23h,24h and set the default input to mic-in */ 11051 /* Unmute Selector 23h,24h and set the default input to mic-in */
10363 11052
10364 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, 11053 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
10365 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 11054 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10366 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, 11055 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
@@ -10559,7 +11248,7 @@ static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
10559 11248
10560 nid = cfg->line_out_pins[0]; 11249 nid = cfg->line_out_pins[0];
10561 if (nid) 11250 if (nid)
10562 alc268_new_analog_output(spec, nid, "Front", 0); 11251 alc268_new_analog_output(spec, nid, "Front", 0);
10563 11252
10564 nid = cfg->speaker_pins[0]; 11253 nid = cfg->speaker_pins[0];
10565 if (nid == 0x1d) { 11254 if (nid == 0x1d) {
@@ -10581,7 +11270,7 @@ static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
10581 if (err < 0) 11270 if (err < 0)
10582 return err; 11271 return err;
10583 } 11272 }
10584 return 0; 11273 return 0;
10585} 11274}
10586 11275
10587/* create playback/capture controls for input pins */ 11276/* create playback/capture controls for input pins */
@@ -10602,7 +11291,7 @@ static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
10602 case 0x1a: 11291 case 0x1a:
10603 idx1 = 2; /* Line In */ 11292 idx1 = 2; /* Line In */
10604 break; 11293 break;
10605 case 0x1c: 11294 case 0x1c:
10606 idx1 = 3; /* CD */ 11295 idx1 = 3; /* CD */
10607 break; 11296 break;
10608 case 0x12: 11297 case 0x12:
@@ -10614,7 +11303,7 @@ static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
10614 } 11303 }
10615 imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; 11304 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
10616 imux->items[imux->num_items].index = idx1; 11305 imux->items[imux->num_items].index = idx1;
10617 imux->num_items++; 11306 imux->num_items++;
10618 } 11307 }
10619 return 0; 11308 return 0;
10620} 11309}
@@ -10644,11 +11333,11 @@ static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
10644 } 11333 }
10645 11334
10646 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ 11335 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
10647 if (line_nid == 0x14) 11336 if (line_nid == 0x14)
10648 dac_vol2 = AMP_OUT_ZERO; 11337 dac_vol2 = AMP_OUT_ZERO;
10649 else if (line_nid == 0x15) 11338 else if (line_nid == 0x15)
10650 dac_vol1 = AMP_OUT_ZERO; 11339 dac_vol1 = AMP_OUT_ZERO;
10651 if (hp_nid == 0x14) 11340 if (hp_nid == 0x14)
10652 dac_vol2 = AMP_OUT_ZERO; 11341 dac_vol2 = AMP_OUT_ZERO;
10653 else if (hp_nid == 0x15) 11342 else if (hp_nid == 0x15)
10654 dac_vol1 = AMP_OUT_ZERO; 11343 dac_vol1 = AMP_OUT_ZERO;
@@ -10739,6 +11428,7 @@ static const char *alc268_models[ALC268_MODEL_LAST] = {
10739 [ALC268_3ST] = "3stack", 11428 [ALC268_3ST] = "3stack",
10740 [ALC268_TOSHIBA] = "toshiba", 11429 [ALC268_TOSHIBA] = "toshiba",
10741 [ALC268_ACER] = "acer", 11430 [ALC268_ACER] = "acer",
11431 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
10742 [ALC268_DELL] = "dell", 11432 [ALC268_DELL] = "dell",
10743 [ALC268_ZEPTO] = "zepto", 11433 [ALC268_ZEPTO] = "zepto",
10744#ifdef CONFIG_SND_DEBUG 11434#ifdef CONFIG_SND_DEBUG
@@ -10753,11 +11443,14 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = {
10753 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), 11443 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
10754 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), 11444 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
10755 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), 11445 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11446 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11447 ALC268_ACER_ASPIRE_ONE),
10756 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), 11448 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
10757 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), 11449 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
10758 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), 11450 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
10759 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), 11451 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
10760 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), 11452 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
11453 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
10761 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), 11454 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
10762 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), 11455 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
10763 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), 11456 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
@@ -10830,6 +11523,23 @@ static struct alc_config_preset alc268_presets[] = {
10830 .unsol_event = alc268_acer_unsol_event, 11523 .unsol_event = alc268_acer_unsol_event,
10831 .init_hook = alc268_acer_init_hook, 11524 .init_hook = alc268_acer_init_hook,
10832 }, 11525 },
11526 [ALC268_ACER_ASPIRE_ONE] = {
11527 .mixers = { alc268_acer_aspire_one_mixer,
11528 alc268_capture_alt_mixer },
11529 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11530 alc268_acer_aspire_one_verbs },
11531 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11532 .dac_nids = alc268_dac_nids,
11533 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11534 .adc_nids = alc268_adc_nids_alt,
11535 .capsrc_nids = alc268_capsrc_nids,
11536 .hp_nid = 0x03,
11537 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11538 .channel_mode = alc268_modes,
11539 .input_mux = &alc268_acer_lc_capture_source,
11540 .unsol_event = alc268_acer_lc_unsol_event,
11541 .init_hook = alc268_acer_lc_init_hook,
11542 },
10833 [ALC268_DELL] = { 11543 [ALC268_DELL] = {
10834 .mixers = { alc268_dell_mixer, alc268_beep_mixer }, 11544 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
10835 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 11545 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
@@ -10974,7 +11684,7 @@ static int patch_alc268(struct hda_codec *codec)
10974 codec->patch_ops = alc_patch_ops; 11684 codec->patch_ops = alc_patch_ops;
10975 if (board_config == ALC268_AUTO) 11685 if (board_config == ALC268_AUTO)
10976 spec->init_hook = alc268_auto_init; 11686 spec->init_hook = alc268_auto_init;
10977 11687
10978 return 0; 11688 return 0;
10979} 11689}
10980 11690
@@ -10990,6 +11700,14 @@ static hda_nid_t alc269_adc_nids[1] = {
10990 0x08, 11700 0x08,
10991}; 11701};
10992 11702
11703static hda_nid_t alc269_capsrc_nids[1] = {
11704 0x23,
11705};
11706
11707/* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
11708 * not a mux!
11709 */
11710
10993static struct hda_input_mux alc269_eeepc_dmic_capture_source = { 11711static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
10994 .num_items = 2, 11712 .num_items = 2,
10995 .items = { 11713 .items = {
@@ -11016,6 +11734,8 @@ static struct snd_kcontrol_new alc269_base_mixer[] = {
11016 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 11734 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11017 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 11735 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11018 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 11736 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11737 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
11738 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
11019 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 11739 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11020 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), 11740 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11021 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), 11741 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
@@ -11025,6 +11745,28 @@ static struct snd_kcontrol_new alc269_base_mixer[] = {
11025 { } /* end */ 11745 { } /* end */
11026}; 11746};
11027 11747
11748static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
11749 /* output mixer control */
11750 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11751 {
11752 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11753 .name = "Master Playback Switch",
11754 .info = snd_hda_mixer_amp_switch_info,
11755 .get = snd_hda_mixer_amp_switch_get,
11756 .put = alc268_acer_master_sw_put,
11757 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11758 },
11759 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11760 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11761 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11762 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11763 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11764 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11765 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
11766 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
11767 { }
11768};
11769
11028/* bind volumes of both NID 0x0c and 0x0d */ 11770/* bind volumes of both NID 0x0c and 0x0d */
11029static struct hda_bind_ctls alc269_epc_bind_vol = { 11771static struct hda_bind_ctls alc269_epc_bind_vol = {
11030 .ops = &snd_hda_bind_vol, 11772 .ops = &snd_hda_bind_vol,
@@ -11068,75 +11810,72 @@ static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
11068 { } /* end */ 11810 { } /* end */
11069}; 11811};
11070 11812
11071/* 11813/* beep control */
11072 * generic initialization of ADC, input mixers and output mixers 11814static struct snd_kcontrol_new alc269_beep_mixer[] = {
11073 */ 11815 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
11074static struct hda_verb alc269_init_verbs[] = { 11816 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
11075 /* 11817 { } /* end */
11076 * Unmute ADC0 and set the default input to mic-in 11818};
11077 */
11078 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11079 11819
11080 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the 11820static struct hda_verb alc269_quanta_fl1_verbs[] = {
11081 * analog-loopback mixer widget 11821 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11082 * Note: PASD motherboards uses the Line In 2 as the input for 11822 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11083 * front panel mic (mic 2) 11823 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11084 */ 11824 {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 */ 11825 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11086 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 11826 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11087 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 11827 { }
11088 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 11828};
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 11829
11092 /* 11830/* toggle speaker-output according to the hp-jack state */
11093 * Set up output mixers (0x0c - 0x0e) 11831static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
11094 */ 11832{
11095 /* set vol=0 to output mixers */ 11833 unsigned int present;
11096 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 11834 unsigned char bits;
11097 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11098 11835
11099 /* set up input amps for analog loopback */ 11836 present = snd_hda_codec_read(codec, 0x15, 0,
11100 /* Amp Indices: DAC = 0, mixer = 1 */ 11837 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11101 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 11838 bits = present ? AMP_IN_MUTE(0) : 0;
11102 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 11839 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
11103 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 11840 AMP_IN_MUTE(0), bits);
11104 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 11841 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
11105 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 11842 AMP_IN_MUTE(0), bits);
11106 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11107 11843
11108 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 11844 snd_hda_codec_write(codec, 0x20, 0,
11109 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 11845 AC_VERB_SET_COEF_INDEX, 0x0c);
11110 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 11846 snd_hda_codec_write(codec, 0x20, 0,
11111 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 11847 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 11848
11116 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 11849 snd_hda_codec_write(codec, 0x20, 0,
11117 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 11850 AC_VERB_SET_COEF_INDEX, 0x0c);
11118 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 11851 snd_hda_codec_write(codec, 0x20, 0,
11119 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 11852 AC_VERB_SET_PROC_COEF, 0x480);
11120 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 11853}
11121 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11122 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11123 11854
11124 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, 11855static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
11125 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, 11856{
11857 unsigned int present;
11126 11858
11127 /* FIXME: use matrix-type input source selection */ 11859 present = snd_hda_codec_read(codec, 0x18, 0,
11128 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ 11860 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11129 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ 11861 snd_hda_codec_write(codec, 0x23, 0,
11130 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 11862 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
11131 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 11863}
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 11864
11135 /* set EAPD */ 11865static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
11136 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, 11866 unsigned int res)
11137 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, 11867{
11138 { } 11868 if ((res >> 26) == ALC880_HP_EVENT)
11139}; 11869 alc269_quanta_fl1_speaker_automute(codec);
11870 if ((res >> 26) == ALC880_MIC_EVENT)
11871 alc269_quanta_fl1_mic_automute(codec);
11872}
11873
11874static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
11875{
11876 alc269_quanta_fl1_speaker_automute(codec);
11877 alc269_quanta_fl1_mic_automute(codec);
11878}
11140 11879
11141static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { 11880static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
11142 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, 11881 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
@@ -11163,42 +11902,42 @@ static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
11163static void alc269_speaker_automute(struct hda_codec *codec) 11902static void alc269_speaker_automute(struct hda_codec *codec)
11164{ 11903{
11165 unsigned int present; 11904 unsigned int present;
11166 unsigned int bits; 11905 unsigned char bits;
11167 11906
11168 present = snd_hda_codec_read(codec, 0x15, 0, 11907 present = snd_hda_codec_read(codec, 0x15, 0,
11169 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 11908 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11170 bits = present ? AMP_IN_MUTE(0) : 0; 11909 bits = present ? AMP_IN_MUTE(0) : 0;
11171 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, 11910 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
11172 AMP_IN_MUTE(0), bits); 11911 AMP_IN_MUTE(0), bits);
11173 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, 11912 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
11174 AMP_IN_MUTE(0), bits); 11913 AMP_IN_MUTE(0), bits);
11175} 11914}
11176 11915
11177static void alc269_eeepc_dmic_automute(struct hda_codec *codec) 11916static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
11178{ 11917{
11179 unsigned int present; 11918 unsigned int present;
11180 11919
11181 present = snd_hda_codec_read(codec, 0x18, 0, AC_VERB_GET_PIN_SENSE, 0) 11920 present = snd_hda_codec_read(codec, 0x18, 0,
11182 & AC_PINSENSE_PRESENCE; 11921 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11183 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, 11922 snd_hda_codec_write(codec, 0x23, 0,
11184 present ? 0 : 5); 11923 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
11185} 11924}
11186 11925
11187static void alc269_eeepc_amic_automute(struct hda_codec *codec) 11926static void alc269_eeepc_amic_automute(struct hda_codec *codec)
11188{ 11927{
11189 unsigned int present; 11928 unsigned int present;
11190 11929
11191 present = snd_hda_codec_read(codec, 0x18, 0, AC_VERB_GET_PIN_SENSE, 0) 11930 present = snd_hda_codec_read(codec, 0x18, 0,
11192 & AC_PINSENSE_PRESENCE; 11931 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11193 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, 11932 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11194 present ? AMP_IN_UNMUTE(0) : AMP_IN_MUTE(0)); 11933 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
11195 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, 11934 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11196 present ? AMP_IN_MUTE(1) : AMP_IN_UNMUTE(1)); 11935 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
11197} 11936}
11198 11937
11199/* unsolicited event for HP jack sensing */ 11938/* unsolicited event for HP jack sensing */
11200static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, 11939static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
11201 unsigned int res) 11940 unsigned int res)
11202{ 11941{
11203 if ((res >> 26) == ALC880_HP_EVENT) 11942 if ((res >> 26) == ALC880_HP_EVENT)
11204 alc269_speaker_automute(codec); 11943 alc269_speaker_automute(codec);
@@ -11215,7 +11954,7 @@ static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
11215 11954
11216/* unsolicited event for HP jack sensing */ 11955/* unsolicited event for HP jack sensing */
11217static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, 11956static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
11218 unsigned int res) 11957 unsigned int res)
11219{ 11958{
11220 if ((res >> 26) == ALC880_HP_EVENT) 11959 if ((res >> 26) == ALC880_HP_EVENT)
11221 alc269_speaker_automute(codec); 11960 alc269_speaker_automute(codec);
@@ -11230,6 +11969,76 @@ static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
11230 alc269_eeepc_amic_automute(codec); 11969 alc269_eeepc_amic_automute(codec);
11231} 11970}
11232 11971
11972/*
11973 * generic initialization of ADC, input mixers and output mixers
11974 */
11975static struct hda_verb alc269_init_verbs[] = {
11976 /*
11977 * Unmute ADC0 and set the default input to mic-in
11978 */
11979 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11980
11981 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
11982 * analog-loopback mixer widget
11983 * Note: PASD motherboards uses the Line In 2 as the input for
11984 * front panel mic (mic 2)
11985 */
11986 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11987 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11988 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11989 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11990 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11991 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11992
11993 /*
11994 * Set up output mixers (0x0c - 0x0e)
11995 */
11996 /* set vol=0 to output mixers */
11997 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11998 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11999
12000 /* set up input amps for analog loopback */
12001 /* Amp Indices: DAC = 0, mixer = 1 */
12002 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12003 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12004 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12005 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12006 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12007 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12008
12009 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12010 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12011 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12012 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12013 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12014 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12015 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12016
12017 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12018 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12019 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12020 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12021 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12022 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12023 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12024
12025 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12026 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12027
12028 /* FIXME: use matrix-type input source selection */
12029 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12030 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12031 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12032 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12033 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12034 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12035
12036 /* set EAPD */
12037 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12038 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12039 { }
12040};
12041
11233/* add playback controls from the parsed DAC table */ 12042/* add playback controls from the parsed DAC table */
11234static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, 12043static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
11235 const struct auto_pin_cfg *cfg) 12044 const struct auto_pin_cfg *cfg)
@@ -11330,7 +12139,7 @@ static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
11330static int alc269_parse_auto_config(struct hda_codec *codec) 12139static int alc269_parse_auto_config(struct hda_codec *codec)
11331{ 12140{
11332 struct alc_spec *spec = codec->spec; 12141 struct alc_spec *spec = codec->spec;
11333 int err; 12142 int i, err;
11334 static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; 12143 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
11335 12144
11336 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, 12145 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
@@ -11353,9 +12162,20 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
11353 if (spec->kctl_alloc) 12162 if (spec->kctl_alloc)
11354 spec->mixers[spec->num_mixers++] = spec->kctl_alloc; 12163 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11355 12164
12165 /* create a beep mixer control if the pin 0x1d isn't assigned */
12166 for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++)
12167 if (spec->autocfg.input_pins[i] == 0x1d)
12168 break;
12169 if (i >= ARRAY_SIZE(spec->autocfg.input_pins))
12170 spec->mixers[spec->num_mixers++] = alc269_beep_mixer;
12171
11356 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; 12172 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs;
11357 spec->num_mux_defs = 1; 12173 spec->num_mux_defs = 1;
11358 spec->input_mux = &spec->private_imux; 12174 spec->input_mux = &spec->private_imux;
12175 /* set default input source */
12176 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12177 0, AC_VERB_SET_CONNECT_SEL,
12178 spec->input_mux->items[0].index);
11359 12179
11360 err = alc_auto_add_mic_boost(codec); 12180 err = alc_auto_add_mic_boost(codec);
11361 if (err < 0) 12181 if (err < 0)
@@ -11387,14 +12207,20 @@ static void alc269_auto_init(struct hda_codec *codec)
11387 * configuration and preset 12207 * configuration and preset
11388 */ 12208 */
11389static const char *alc269_models[ALC269_MODEL_LAST] = { 12209static const char *alc269_models[ALC269_MODEL_LAST] = {
11390 [ALC269_BASIC] = "basic", 12210 [ALC269_BASIC] = "basic",
12211 [ALC269_QUANTA_FL1] = "quanta",
12212 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12213 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901"
11391}; 12214};
11392 12215
11393static struct snd_pci_quirk alc269_cfg_tbl[] = { 12216static struct snd_pci_quirk alc269_cfg_tbl[] = {
12217 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
11394 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", 12218 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
11395 ALC269_ASUS_EEEPC_P703), 12219 ALC269_ASUS_EEEPC_P703),
11396 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", 12220 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
11397 ALC269_ASUS_EEEPC_P901), 12221 ALC269_ASUS_EEEPC_P901),
12222 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12223 ALC269_ASUS_EEEPC_P901),
11398 {} 12224 {}
11399}; 12225};
11400 12226
@@ -11409,6 +12235,18 @@ static struct alc_config_preset alc269_presets[] = {
11409 .channel_mode = alc269_modes, 12235 .channel_mode = alc269_modes,
11410 .input_mux = &alc269_capture_source, 12236 .input_mux = &alc269_capture_source,
11411 }, 12237 },
12238 [ALC269_QUANTA_FL1] = {
12239 .mixers = { alc269_quanta_fl1_mixer },
12240 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12241 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12242 .dac_nids = alc269_dac_nids,
12243 .hp_nid = 0x03,
12244 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12245 .channel_mode = alc269_modes,
12246 .input_mux = &alc269_capture_source,
12247 .unsol_event = alc269_quanta_fl1_unsol_event,
12248 .init_hook = alc269_quanta_fl1_init_hook,
12249 },
11412 [ALC269_ASUS_EEEPC_P703] = { 12250 [ALC269_ASUS_EEEPC_P703] = {
11413 .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer }, 12251 .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer },
11414 .init_verbs = { alc269_init_verbs, 12252 .init_verbs = { alc269_init_verbs,
@@ -11488,6 +12326,7 @@ static int patch_alc269(struct hda_codec *codec)
11488 12326
11489 spec->adc_nids = alc269_adc_nids; 12327 spec->adc_nids = alc269_adc_nids;
11490 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); 12328 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
12329 spec->capsrc_nids = alc269_capsrc_nids;
11491 12330
11492 codec->patch_ops = alc_patch_ops; 12331 codec->patch_ops = alc_patch_ops;
11493 if (board_config == ALC269_AUTO) 12332 if (board_config == ALC269_AUTO)
@@ -11689,7 +12528,7 @@ static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
11689 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), 12528 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11690 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), 12529 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11691 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), 12530 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11692 12531
11693 /*Capture mixer control */ 12532 /*Capture mixer control */
11694 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 12533 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11695 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 12534 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
@@ -11832,20 +12671,20 @@ static struct hda_verb alc861_base_init_verbs[] = {
11832 /* route front mic to ADC1*/ 12671 /* route front mic to ADC1*/
11833 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 12672 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11834 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12673 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11835 12674
11836 /* Unmute DAC0~3 & spdif out*/ 12675 /* Unmute DAC0~3 & spdif out*/
11837 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 12676 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11838 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 12677 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11839 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 12678 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11840 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 12679 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11841 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 12680 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11842 12681
11843 /* Unmute Mixer 14 (mic) 1c (Line in)*/ 12682 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11844 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12683 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11845 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12684 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11846 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12685 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11847 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12686 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11848 12687
11849 /* Unmute Stereo Mixer 15 */ 12688 /* Unmute Stereo Mixer 15 */
11850 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12689 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11851 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12690 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
@@ -11901,13 +12740,13 @@ static struct hda_verb alc861_threestack_init_verbs[] = {
11901 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 12740 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11902 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 12741 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11903 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 12742 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11904 12743
11905 /* Unmute Mixer 14 (mic) 1c (Line in)*/ 12744 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11906 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12745 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11907 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12746 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11908 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12747 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11909 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12748 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11910 12749
11911 /* Unmute Stereo Mixer 15 */ 12750 /* Unmute Stereo Mixer 15 */
11912 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12751 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11913 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12752 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
@@ -11963,13 +12802,13 @@ static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
11963 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 12802 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11964 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 12803 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11965 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 12804 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11966 12805
11967 /* Unmute Mixer 14 (mic) 1c (Line in)*/ 12806 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11968 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12807 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11969 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12808 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11970 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12809 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11971 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12810 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11972 12811
11973 /* Unmute Stereo Mixer 15 */ 12812 /* Unmute Stereo Mixer 15 */
11974 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12813 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11975 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12814 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
@@ -12034,7 +12873,7 @@ static struct hda_verb alc861_asus_init_verbs[] = {
12034 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12873 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12035 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12874 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12036 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12875 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12037 12876
12038 /* Unmute Stereo Mixer 15 */ 12877 /* Unmute Stereo Mixer 15 */
12039 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12878 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12040 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12879 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
@@ -12071,20 +12910,20 @@ static struct hda_verb alc861_auto_init_verbs[] = {
12071 */ 12910 */
12072 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ 12911 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
12073 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12912 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12074 12913
12075 /* Unmute DAC0~3 & spdif out*/ 12914 /* Unmute DAC0~3 & spdif out*/
12076 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 12915 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12077 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 12916 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12078 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 12917 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12079 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 12918 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12080 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 12919 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12081 12920
12082 /* Unmute Mixer 14 (mic) 1c (Line in)*/ 12921 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12083 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12922 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12084 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12923 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12085 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12924 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12086 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12925 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12087 12926
12088 /* Unmute Stereo Mixer 15 */ 12927 /* Unmute Stereo Mixer 15 */
12089 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 12928 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12090 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 12929 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
@@ -12659,7 +13498,7 @@ static int patch_alc861(struct hda_codec *codec)
12659 if (!spec->loopback.amplist) 13498 if (!spec->loopback.amplist)
12660 spec->loopback.amplist = alc861_loopbacks; 13499 spec->loopback.amplist = alc861_loopbacks;
12661#endif 13500#endif
12662 13501
12663 return 0; 13502 return 0;
12664} 13503}
12665 13504
@@ -12913,7 +13752,7 @@ static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
12913 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 13752 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12914 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 13753 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12915 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 13754 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12916 13755
12917 { } /* end */ 13756 { } /* end */
12918}; 13757};
12919 13758
@@ -13058,7 +13897,7 @@ static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
13058 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 13897 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13059 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, 13898 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
13060 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 13899 {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}, 13900 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13062 {} 13901 {}
13063}; 13902};
13064 13903
@@ -13120,7 +13959,7 @@ static struct hda_verb alc861vd_dallas_verbs[] = {
13120 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 13959 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13121 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 13960 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13122 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 13961 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13123 13962
13124 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 13963 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13125 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 13964 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13126 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 13965 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
@@ -13145,7 +13984,7 @@ static struct hda_verb alc861vd_dallas_verbs[] = {
13145 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 13984 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13146 13985
13147 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 13986 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13148 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, 13987 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13149 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 13988 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13150 13989
13151 { } /* end */ 13990 { } /* end */
@@ -13304,7 +14143,7 @@ static struct alc_config_preset alc861vd_presets[] = {
13304 .input_mux = &alc861vd_hp_capture_source, 14143 .input_mux = &alc861vd_hp_capture_source,
13305 .unsol_event = alc861vd_dallas_unsol_event, 14144 .unsol_event = alc861vd_dallas_unsol_event,
13306 .init_hook = alc861vd_dallas_automute, 14145 .init_hook = alc861vd_dallas_automute,
13307 }, 14146 },
13308}; 14147};
13309 14148
13310/* 14149/*
@@ -13883,13 +14722,120 @@ static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
13883 { } /* end */ 14722 { } /* end */
13884}; 14723};
13885 14724
14725static struct hda_bind_ctls alc663_asus_bind_master_vol = {
14726 .ops = &snd_hda_bind_vol,
14727 .values = {
14728 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
14729 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
14730 0
14731 },
14732};
14733
14734static struct hda_bind_ctls alc663_asus_one_bind_switch = {
14735 .ops = &snd_hda_bind_sw,
14736 .values = {
14737 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14738 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
14739 0
14740 },
14741};
14742
13886static struct snd_kcontrol_new alc663_m51va_mixer[] = { 14743static struct snd_kcontrol_new alc663_m51va_mixer[] = {
14744 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14745 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
14746 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14747 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14748 { } /* end */
14749};
14750
14751static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
14752 .ops = &snd_hda_bind_sw,
14753 .values = {
14754 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14755 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
14756 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
14757 0
14758 },
14759};
14760
14761static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
14762 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14763 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
14764 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14765 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14766 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14767 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14768
14769 { } /* end */
14770};
14771
14772static struct hda_bind_ctls alc663_asus_four_bind_switch = {
14773 .ops = &snd_hda_bind_sw,
14774 .values = {
14775 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14776 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
14777 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
14778 0
14779 },
14780};
14781
14782static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
14783 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14784 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
14785 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14786 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14787 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14788 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14789 { } /* end */
14790};
14791
14792static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
13887 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), 14793 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13888 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), 14794 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14795 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14796 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14797 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14798 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14799 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14800 { } /* end */
14801};
14802
14803static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
14804 .ops = &snd_hda_bind_vol,
14805 .values = {
14806 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
14807 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
14808 0
14809 },
14810};
14811
14812static struct hda_bind_ctls alc663_asus_two_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(0x16, 3, 0, HDA_OUTPUT),
14817 0
14818 },
14819};
14820
14821static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
14822 HDA_BIND_VOL("Master Playback Volume",
14823 &alc663_asus_two_bind_master_vol),
14824 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
14825 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13889 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), 14826 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13890 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 14827 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13891 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 14828 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13892 HDA_CODEC_MUTE("DMic Playback Switch", 0x23, 0x9, HDA_INPUT), 14829 { } /* end */
14830};
14831
14832static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
14833 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14834 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
14835 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14836 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14837 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14838 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13893 { } /* end */ 14839 { } /* end */
13894}; 14840};
13895 14841
@@ -14074,14 +15020,81 @@ static struct hda_verb alc663_auto_init_verbs[] = {
14074}; 15020};
14075 15021
14076static struct hda_verb alc663_m51va_init_verbs[] = { 15022static struct hda_verb alc663_m51va_init_verbs[] = {
15023 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15024 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14077 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 15025 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14078 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 15026 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14079 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ 15027 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15028 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15029 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15030 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15031 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15032 {}
15033};
14080 15034
14081 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, 15035static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15036 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15037 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15038 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15039 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15040 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15041 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15042 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15043 {}
15044};
14082 15045
15046static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15047 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15048 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15049 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15050 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15051 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15052 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15053 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15054 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15055 {}
15056};
15057
15058static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15059 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15060 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15061 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15062 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15063 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15064 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15065 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15066 {}
15067};
15068
15069static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15070 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15071 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15072 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15073 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15074 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15075 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15076 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15077 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15078 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14083 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, 15079 {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}, 15080 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15081 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15082 {}
15083};
15084
15085static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15086 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15087 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15088 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15089 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15090 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15091 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15092 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15093 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15094 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15095 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15096 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15097 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14085 {} 15098 {}
14086}; 15099};
14087 15100
@@ -14110,6 +15123,14 @@ static struct hda_verb alc663_g50v_init_verbs[] = {
14110 {} 15123 {}
14111}; 15124};
14112 15125
15126static struct hda_verb alc662_ecs_init_verbs[] = {
15127 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15128 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15129 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15130 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15131 {}
15132};
15133
14113/* capture mixer elements */ 15134/* capture mixer elements */
14114static struct snd_kcontrol_new alc662_capture_mixer[] = { 15135static struct snd_kcontrol_new alc662_capture_mixer[] = {
14115 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), 15136 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
@@ -14129,6 +15150,12 @@ static struct snd_kcontrol_new alc662_capture_mixer[] = {
14129 { } /* end */ 15150 { } /* end */
14130}; 15151};
14131 15152
15153static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15154 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15155 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15156 { } /* end */
15157};
15158
14132static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) 15159static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
14133{ 15160{
14134 unsigned int present; 15161 unsigned int present;
@@ -14209,12 +15236,12 @@ static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
14209 if (present) { 15236 if (present) {
14210 /* mute internal speaker */ 15237 /* mute internal speaker */
14211 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, 15238 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
14212 HDA_AMP_MUTE, HDA_AMP_MUTE); 15239 HDA_AMP_MUTE, HDA_AMP_MUTE);
14213 } else { 15240 } else {
14214 /* unmute internal speaker if necessary */ 15241 /* unmute internal speaker if necessary */
14215 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); 15242 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
14216 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, 15243 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
14217 HDA_AMP_MUTE, mute); 15244 HDA_AMP_MUTE, mute);
14218 } 15245 }
14219} 15246}
14220 15247
@@ -14237,11 +15264,108 @@ static void alc663_m51va_speaker_automute(struct hda_codec *codec)
14237 unsigned char bits; 15264 unsigned char bits;
14238 15265
14239 present = snd_hda_codec_read(codec, 0x21, 0, 15266 present = snd_hda_codec_read(codec, 0x21, 0,
14240 AC_VERB_GET_PIN_SENSE, 0) 15267 AC_VERB_GET_PIN_SENSE, 0)
14241 & AC_PINSENSE_PRESENCE; 15268 & AC_PINSENSE_PRESENCE;
14242 bits = present ? HDA_AMP_MUTE : 0; 15269 bits = present ? HDA_AMP_MUTE : 0;
14243 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 15270 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14244 HDA_AMP_MUTE, bits); 15271 AMP_IN_MUTE(0), bits);
15272 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15273 AMP_IN_MUTE(0), bits);
15274}
15275
15276static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15277{
15278 unsigned int present;
15279 unsigned char bits;
15280
15281 present = snd_hda_codec_read(codec, 0x21, 0,
15282 AC_VERB_GET_PIN_SENSE, 0)
15283 & AC_PINSENSE_PRESENCE;
15284 bits = present ? HDA_AMP_MUTE : 0;
15285 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15286 AMP_IN_MUTE(0), bits);
15287 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15288 AMP_IN_MUTE(0), bits);
15289 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15290 AMP_IN_MUTE(0), bits);
15291 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15292 AMP_IN_MUTE(0), bits);
15293}
15294
15295static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15296{
15297 unsigned int present;
15298 unsigned char bits;
15299
15300 present = snd_hda_codec_read(codec, 0x15, 0,
15301 AC_VERB_GET_PIN_SENSE, 0)
15302 & AC_PINSENSE_PRESENCE;
15303 bits = present ? HDA_AMP_MUTE : 0;
15304 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15305 AMP_IN_MUTE(0), bits);
15306 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15307 AMP_IN_MUTE(0), bits);
15308 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15309 AMP_IN_MUTE(0), bits);
15310 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15311 AMP_IN_MUTE(0), bits);
15312}
15313
15314static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15315{
15316 unsigned int present;
15317 unsigned char bits;
15318
15319 present = snd_hda_codec_read(codec, 0x1b, 0,
15320 AC_VERB_GET_PIN_SENSE, 0)
15321 & AC_PINSENSE_PRESENCE;
15322 bits = present ? 0 : PIN_OUT;
15323 snd_hda_codec_write(codec, 0x14, 0,
15324 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15325}
15326
15327static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15328{
15329 unsigned int present1, present2;
15330
15331 present1 = snd_hda_codec_read(codec, 0x21, 0,
15332 AC_VERB_GET_PIN_SENSE, 0)
15333 & AC_PINSENSE_PRESENCE;
15334 present2 = snd_hda_codec_read(codec, 0x15, 0,
15335 AC_VERB_GET_PIN_SENSE, 0)
15336 & AC_PINSENSE_PRESENCE;
15337
15338 if (present1 || present2) {
15339 snd_hda_codec_write_cache(codec, 0x14, 0,
15340 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15341 } else {
15342 snd_hda_codec_write_cache(codec, 0x14, 0,
15343 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15344 }
15345}
15346
15347static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15348{
15349 unsigned int present1, present2;
15350
15351 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15352 AC_VERB_GET_PIN_SENSE, 0)
15353 & AC_PINSENSE_PRESENCE;
15354 present2 = snd_hda_codec_read(codec, 0x15, 0,
15355 AC_VERB_GET_PIN_SENSE, 0)
15356 & AC_PINSENSE_PRESENCE;
15357
15358 if (present1 || present2) {
15359 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15360 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15361 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15362 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15363 } else {
15364 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15365 AMP_IN_MUTE(0), 0);
15366 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15367 AMP_IN_MUTE(0), 0);
15368 }
14245} 15369}
14246 15370
14247static void alc663_m51va_mic_automute(struct hda_codec *codec) 15371static void alc663_m51va_mic_automute(struct hda_codec *codec)
@@ -14249,16 +15373,16 @@ static void alc663_m51va_mic_automute(struct hda_codec *codec)
14249 unsigned int present; 15373 unsigned int present;
14250 15374
14251 present = snd_hda_codec_read(codec, 0x18, 0, 15375 present = snd_hda_codec_read(codec, 0x18, 0,
14252 AC_VERB_GET_PIN_SENSE, 0) 15376 AC_VERB_GET_PIN_SENSE, 0)
14253 & AC_PINSENSE_PRESENCE; 15377 & AC_PINSENSE_PRESENCE;
14254 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, 15378 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14255 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); 15379 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
14256 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, 15380 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14257 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); 15381 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
14258 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, 15382 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14259 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); 15383 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
14260 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, 15384 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14261 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); 15385 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
14262} 15386}
14263 15387
14264static void alc663_m51va_unsol_event(struct hda_codec *codec, 15388static void alc663_m51va_unsol_event(struct hda_codec *codec,
@@ -14280,6 +15404,121 @@ static void alc663_m51va_inithook(struct hda_codec *codec)
14280 alc663_m51va_mic_automute(codec); 15404 alc663_m51va_mic_automute(codec);
14281} 15405}
14282 15406
15407/* ***************** Mode1 ******************************/
15408static void alc663_mode1_unsol_event(struct hda_codec *codec,
15409 unsigned int res)
15410{
15411 switch (res >> 26) {
15412 case ALC880_HP_EVENT:
15413 alc663_m51va_speaker_automute(codec);
15414 break;
15415 case ALC880_MIC_EVENT:
15416 alc662_eeepc_mic_automute(codec);
15417 break;
15418 }
15419}
15420
15421static void alc663_mode1_inithook(struct hda_codec *codec)
15422{
15423 alc663_m51va_speaker_automute(codec);
15424 alc662_eeepc_mic_automute(codec);
15425}
15426/* ***************** Mode2 ******************************/
15427static void alc662_mode2_unsol_event(struct hda_codec *codec,
15428 unsigned int res)
15429{
15430 switch (res >> 26) {
15431 case ALC880_HP_EVENT:
15432 alc662_f5z_speaker_automute(codec);
15433 break;
15434 case ALC880_MIC_EVENT:
15435 alc662_eeepc_mic_automute(codec);
15436 break;
15437 }
15438}
15439
15440static void alc662_mode2_inithook(struct hda_codec *codec)
15441{
15442 alc662_f5z_speaker_automute(codec);
15443 alc662_eeepc_mic_automute(codec);
15444}
15445/* ***************** Mode3 ******************************/
15446static void alc663_mode3_unsol_event(struct hda_codec *codec,
15447 unsigned int res)
15448{
15449 switch (res >> 26) {
15450 case ALC880_HP_EVENT:
15451 alc663_two_hp_m1_speaker_automute(codec);
15452 break;
15453 case ALC880_MIC_EVENT:
15454 alc662_eeepc_mic_automute(codec);
15455 break;
15456 }
15457}
15458
15459static void alc663_mode3_inithook(struct hda_codec *codec)
15460{
15461 alc663_two_hp_m1_speaker_automute(codec);
15462 alc662_eeepc_mic_automute(codec);
15463}
15464/* ***************** Mode4 ******************************/
15465static void alc663_mode4_unsol_event(struct hda_codec *codec,
15466 unsigned int res)
15467{
15468 switch (res >> 26) {
15469 case ALC880_HP_EVENT:
15470 alc663_21jd_two_speaker_automute(codec);
15471 break;
15472 case ALC880_MIC_EVENT:
15473 alc662_eeepc_mic_automute(codec);
15474 break;
15475 }
15476}
15477
15478static void alc663_mode4_inithook(struct hda_codec *codec)
15479{
15480 alc663_21jd_two_speaker_automute(codec);
15481 alc662_eeepc_mic_automute(codec);
15482}
15483/* ***************** Mode5 ******************************/
15484static void alc663_mode5_unsol_event(struct hda_codec *codec,
15485 unsigned int res)
15486{
15487 switch (res >> 26) {
15488 case ALC880_HP_EVENT:
15489 alc663_15jd_two_speaker_automute(codec);
15490 break;
15491 case ALC880_MIC_EVENT:
15492 alc662_eeepc_mic_automute(codec);
15493 break;
15494 }
15495}
15496
15497static void alc663_mode5_inithook(struct hda_codec *codec)
15498{
15499 alc663_15jd_two_speaker_automute(codec);
15500 alc662_eeepc_mic_automute(codec);
15501}
15502/* ***************** Mode6 ******************************/
15503static void alc663_mode6_unsol_event(struct hda_codec *codec,
15504 unsigned int res)
15505{
15506 switch (res >> 26) {
15507 case ALC880_HP_EVENT:
15508 alc663_two_hp_m2_speaker_automute(codec);
15509 break;
15510 case ALC880_MIC_EVENT:
15511 alc662_eeepc_mic_automute(codec);
15512 break;
15513 }
15514}
15515
15516static void alc663_mode6_inithook(struct hda_codec *codec)
15517{
15518 alc663_two_hp_m2_speaker_automute(codec);
15519 alc662_eeepc_mic_automute(codec);
15520}
15521
14283static void alc663_g71v_hp_automute(struct hda_codec *codec) 15522static void alc663_g71v_hp_automute(struct hda_codec *codec)
14284{ 15523{
14285 unsigned int present; 15524 unsigned int present;
@@ -14350,6 +15589,46 @@ static void alc663_g50v_inithook(struct hda_codec *codec)
14350 alc662_eeepc_mic_automute(codec); 15589 alc662_eeepc_mic_automute(codec);
14351} 15590}
14352 15591
15592/* bind hp and internal speaker mute (with plug check) */
15593static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
15594 struct snd_ctl_elem_value *ucontrol)
15595{
15596 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
15597 long *valp = ucontrol->value.integer.value;
15598 int change;
15599
15600 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
15601 HDA_AMP_MUTE,
15602 valp[0] ? 0 : HDA_AMP_MUTE);
15603 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
15604 HDA_AMP_MUTE,
15605 valp[1] ? 0 : HDA_AMP_MUTE);
15606 if (change)
15607 alc262_hippo1_automute(codec);
15608 return change;
15609}
15610
15611static struct snd_kcontrol_new alc662_ecs_mixer[] = {
15612 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15613 {
15614 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15615 .name = "Master Playback Switch",
15616 .info = snd_hda_mixer_amp_switch_info,
15617 .get = snd_hda_mixer_amp_switch_get,
15618 .put = alc662_ecs_master_sw_put,
15619 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15620 },
15621
15622 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
15623 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
15624 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
15625
15626 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15627 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15628 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15629 { } /* end */
15630};
15631
14353#ifdef CONFIG_SND_HDA_POWER_SAVE 15632#ifdef CONFIG_SND_HDA_POWER_SAVE
14354#define alc662_loopbacks alc880_loopbacks 15633#define alc662_loopbacks alc880_loopbacks
14355#endif 15634#endif
@@ -14372,21 +15651,67 @@ static const char *alc662_models[ALC662_MODEL_LAST] = {
14372 [ALC662_LENOVO_101E] = "lenovo-101e", 15651 [ALC662_LENOVO_101E] = "lenovo-101e",
14373 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", 15652 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
14374 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", 15653 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
15654 [ALC662_ECS] = "ecs",
14375 [ALC663_ASUS_M51VA] = "m51va", 15655 [ALC663_ASUS_M51VA] = "m51va",
14376 [ALC663_ASUS_G71V] = "g71v", 15656 [ALC663_ASUS_G71V] = "g71v",
14377 [ALC663_ASUS_H13] = "h13", 15657 [ALC663_ASUS_H13] = "h13",
14378 [ALC663_ASUS_G50V] = "g50v", 15658 [ALC663_ASUS_G50V] = "g50v",
15659 [ALC663_ASUS_MODE1] = "asus-mode1",
15660 [ALC662_ASUS_MODE2] = "asus-mode2",
15661 [ALC663_ASUS_MODE3] = "asus-mode3",
15662 [ALC663_ASUS_MODE4] = "asus-mode4",
15663 [ALC663_ASUS_MODE5] = "asus-mode5",
15664 [ALC663_ASUS_MODE6] = "asus-mode6",
14379 [ALC662_AUTO] = "auto", 15665 [ALC662_AUTO] = "auto",
14380}; 15666};
14381 15667
14382static struct snd_pci_quirk alc662_cfg_tbl[] = { 15668static 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), 15669 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
14385 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V), 15670 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V),
14386 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), 15671 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
14387 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), 15672 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
14388 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), 15673 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
15674 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
15675 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),
15676 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
15677 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
15678 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
15679 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),
15680 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
15681 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
15682 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
15683 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
15684 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
15685 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
15686 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
15687 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
15688 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
15689 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
15690 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
15691 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
15692 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
15693 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
15694 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
15695 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
15696 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
15697 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
15698 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
15699 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
15700 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
15701 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
15702 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
15703 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
15704 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
15705 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
15706 ALC662_3ST_6ch_DIG),
14389 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), 15707 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
15708 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
15709 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
15710 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
15711 ALC662_3ST_6ch_DIG),
15712 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
15713 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
15714 ALC662_3ST_6ch_DIG),
14390 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), 15715 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
14391 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), 15716 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
14392 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), 15717 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
@@ -14477,6 +15802,18 @@ static struct alc_config_preset alc662_presets[] = {
14477 .unsol_event = alc662_eeepc_ep20_unsol_event, 15802 .unsol_event = alc662_eeepc_ep20_unsol_event,
14478 .init_hook = alc662_eeepc_ep20_inithook, 15803 .init_hook = alc662_eeepc_ep20_inithook,
14479 }, 15804 },
15805 [ALC662_ECS] = {
15806 .mixers = { alc662_ecs_mixer, alc662_capture_mixer },
15807 .init_verbs = { alc662_init_verbs,
15808 alc662_ecs_init_verbs },
15809 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15810 .dac_nids = alc662_dac_nids,
15811 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15812 .channel_mode = alc662_3ST_2ch_modes,
15813 .input_mux = &alc662_eeepc_capture_source,
15814 .unsol_event = alc662_eeepc_unsol_event,
15815 .init_hook = alc662_eeepc_inithook,
15816 },
14480 [ALC663_ASUS_M51VA] = { 15817 [ALC663_ASUS_M51VA] = {
14481 .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, 15818 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
14482 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, 15819 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
@@ -14524,6 +15861,91 @@ static struct alc_config_preset alc662_presets[] = {
14524 .unsol_event = alc663_g50v_unsol_event, 15861 .unsol_event = alc663_g50v_unsol_event,
14525 .init_hook = alc663_g50v_inithook, 15862 .init_hook = alc663_g50v_inithook,
14526 }, 15863 },
15864 [ALC663_ASUS_MODE1] = {
15865 .mixers = { alc663_m51va_mixer, alc662_auto_capture_mixer },
15866 .init_verbs = { alc662_init_verbs,
15867 alc663_21jd_amic_init_verbs },
15868 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15869 .hp_nid = 0x03,
15870 .dac_nids = alc662_dac_nids,
15871 .dig_out_nid = ALC662_DIGOUT_NID,
15872 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15873 .channel_mode = alc662_3ST_2ch_modes,
15874 .input_mux = &alc662_eeepc_capture_source,
15875 .unsol_event = alc663_mode1_unsol_event,
15876 .init_hook = alc663_mode1_inithook,
15877 },
15878 [ALC662_ASUS_MODE2] = {
15879 .mixers = { alc662_1bjd_mixer, alc662_auto_capture_mixer },
15880 .init_verbs = { alc662_init_verbs,
15881 alc662_1bjd_amic_init_verbs },
15882 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15883 .dac_nids = alc662_dac_nids,
15884 .dig_out_nid = ALC662_DIGOUT_NID,
15885 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15886 .channel_mode = alc662_3ST_2ch_modes,
15887 .input_mux = &alc662_eeepc_capture_source,
15888 .unsol_event = alc662_mode2_unsol_event,
15889 .init_hook = alc662_mode2_inithook,
15890 },
15891 [ALC663_ASUS_MODE3] = {
15892 .mixers = { alc663_two_hp_m1_mixer, alc662_auto_capture_mixer },
15893 .init_verbs = { alc662_init_verbs,
15894 alc663_two_hp_amic_m1_init_verbs },
15895 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15896 .hp_nid = 0x03,
15897 .dac_nids = alc662_dac_nids,
15898 .dig_out_nid = ALC662_DIGOUT_NID,
15899 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15900 .channel_mode = alc662_3ST_2ch_modes,
15901 .input_mux = &alc662_eeepc_capture_source,
15902 .unsol_event = alc663_mode3_unsol_event,
15903 .init_hook = alc663_mode3_inithook,
15904 },
15905 [ALC663_ASUS_MODE4] = {
15906 .mixers = { alc663_asus_21jd_clfe_mixer,
15907 alc662_auto_capture_mixer},
15908 .init_verbs = { alc662_init_verbs,
15909 alc663_21jd_amic_init_verbs},
15910 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15911 .hp_nid = 0x03,
15912 .dac_nids = alc662_dac_nids,
15913 .dig_out_nid = ALC662_DIGOUT_NID,
15914 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15915 .channel_mode = alc662_3ST_2ch_modes,
15916 .input_mux = &alc662_eeepc_capture_source,
15917 .unsol_event = alc663_mode4_unsol_event,
15918 .init_hook = alc663_mode4_inithook,
15919 },
15920 [ALC663_ASUS_MODE5] = {
15921 .mixers = { alc663_asus_15jd_clfe_mixer,
15922 alc662_auto_capture_mixer },
15923 .init_verbs = { alc662_init_verbs,
15924 alc663_15jd_amic_init_verbs },
15925 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15926 .hp_nid = 0x03,
15927 .dac_nids = alc662_dac_nids,
15928 .dig_out_nid = ALC662_DIGOUT_NID,
15929 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15930 .channel_mode = alc662_3ST_2ch_modes,
15931 .input_mux = &alc662_eeepc_capture_source,
15932 .unsol_event = alc663_mode5_unsol_event,
15933 .init_hook = alc663_mode5_inithook,
15934 },
15935 [ALC663_ASUS_MODE6] = {
15936 .mixers = { alc663_two_hp_m2_mixer, alc662_auto_capture_mixer },
15937 .init_verbs = { alc662_init_verbs,
15938 alc663_two_hp_amic_m2_init_verbs },
15939 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15940 .hp_nid = 0x03,
15941 .dac_nids = alc662_dac_nids,
15942 .dig_out_nid = ALC662_DIGOUT_NID,
15943 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15944 .channel_mode = alc662_3ST_2ch_modes,
15945 .input_mux = &alc662_eeepc_capture_source,
15946 .unsol_event = alc663_mode6_unsol_event,
15947 .init_hook = alc663_mode6_inithook,
15948 },
14527}; 15949};
14528 15950
14529 15951
@@ -14560,15 +15982,15 @@ static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
14560 HDA_OUTPUT)); 15982 HDA_OUTPUT));
14561 if (err < 0) 15983 if (err < 0)
14562 return err; 15984 return err;
14563 err = add_control(spec, ALC_CTL_BIND_MUTE, 15985 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
14564 "Center Playback Switch", 15986 "Center Playback Switch",
14565 HDA_COMPOSE_AMP_VAL(nid, 1, 2, 15987 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
14566 HDA_INPUT)); 15988 HDA_INPUT));
14567 if (err < 0) 15989 if (err < 0)
14568 return err; 15990 return err;
14569 err = add_control(spec, ALC_CTL_BIND_MUTE, 15991 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
14570 "LFE Playback Switch", 15992 "LFE Playback Switch",
14571 HDA_COMPOSE_AMP_VAL(nid, 2, 2, 15993 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
14572 HDA_INPUT)); 15994 HDA_INPUT));
14573 if (err < 0) 15995 if (err < 0)
14574 return err; 15996 return err;
@@ -14580,9 +16002,9 @@ static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
14580 if (err < 0) 16002 if (err < 0)
14581 return err; 16003 return err;
14582 sprintf(name, "%s Playback Switch", chname[i]); 16004 sprintf(name, "%s Playback Switch", chname[i]);
14583 err = add_control(spec, ALC_CTL_BIND_MUTE, name, 16005 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14584 HDA_COMPOSE_AMP_VAL(nid, 3, 2, 16006 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
14585 HDA_INPUT)); 16007 3, 0, HDA_INPUT));
14586 if (err < 0) 16008 if (err < 0)
14587 return err; 16009 return err;
14588 } 16010 }
@@ -14777,7 +16199,7 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
14777 16199
14778 spec->num_mux_defs = 1; 16200 spec->num_mux_defs = 1;
14779 spec->input_mux = &spec->private_imux; 16201 spec->input_mux = &spec->private_imux;
14780 16202
14781 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; 16203 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
14782 if (codec->vendor_id == 0x10ec0663) 16204 if (codec->vendor_id == 0x10ec0663)
14783 spec->init_verbs[spec->num_init_verbs++] = 16205 spec->init_verbs[spec->num_init_verbs++] =
@@ -14896,6 +16318,8 @@ struct hda_codec_preset snd_hda_preset_realtek[] = {
14896 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, 16318 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
14897 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, 16319 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
14898 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, 16320 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16321 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16322 .patch = patch_alc882 }, /* should be patch_alc883() in future */
14899 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", 16323 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
14900 .patch = patch_alc882 }, /* should be patch_alc883() in future */ 16324 .patch = patch_alc882 }, /* should be patch_alc883() in future */
14901 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, 16325 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },