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.c1248
1 files changed, 770 insertions, 478 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 33282f9c01c7..cdda64b02f46 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -30,6 +30,7 @@
30#include <sound/core.h> 30#include <sound/core.h>
31#include "hda_codec.h" 31#include "hda_codec.h"
32#include "hda_local.h" 32#include "hda_local.h"
33#include "hda_patch.h"
33 34
34#define ALC880_FRONT_EVENT 0x01 35#define ALC880_FRONT_EVENT 0x01
35#define ALC880_DCVOL_EVENT 0x02 36#define ALC880_DCVOL_EVENT 0x02
@@ -97,16 +98,19 @@ enum {
97 ALC262_SONY_ASSAMD, 98 ALC262_SONY_ASSAMD,
98 ALC262_BENQ_T31, 99 ALC262_BENQ_T31,
99 ALC262_ULTRA, 100 ALC262_ULTRA,
101 ALC262_LENOVO_3000,
100 ALC262_AUTO, 102 ALC262_AUTO,
101 ALC262_MODEL_LAST /* last tag */ 103 ALC262_MODEL_LAST /* last tag */
102}; 104};
103 105
104/* ALC268 models */ 106/* ALC268 models */
105enum { 107enum {
108 ALC267_QUANTA_IL1,
106 ALC268_3ST, 109 ALC268_3ST,
107 ALC268_TOSHIBA, 110 ALC268_TOSHIBA,
108 ALC268_ACER, 111 ALC268_ACER,
109 ALC268_DELL, 112 ALC268_DELL,
113 ALC268_ZEPTO,
110#ifdef CONFIG_SND_DEBUG 114#ifdef CONFIG_SND_DEBUG
111 ALC268_TEST, 115 ALC268_TEST,
112#endif 116#endif
@@ -195,10 +199,11 @@ enum {
195 ALC883_LENOVO_NB0763, 199 ALC883_LENOVO_NB0763,
196 ALC888_LENOVO_MS7195_DIG, 200 ALC888_LENOVO_MS7195_DIG,
197 ALC883_HAIER_W66, 201 ALC883_HAIER_W66,
198 ALC888_6ST_HP,
199 ALC888_3ST_HP, 202 ALC888_3ST_HP,
200 ALC888_6ST_DELL, 203 ALC888_6ST_DELL,
201 ALC883_MITAC, 204 ALC883_MITAC,
205 ALC883_CLEVO_M720,
206 ALC883_FUJITSU_PI2515,
202 ALC883_AUTO, 207 ALC883_AUTO,
203 ALC883_MODEL_LAST, 208 ALC883_MODEL_LAST,
204}; 209};
@@ -237,6 +242,7 @@ struct alc_spec {
237 /* capture */ 242 /* capture */
238 unsigned int num_adc_nids; 243 unsigned int num_adc_nids;
239 hda_nid_t *adc_nids; 244 hda_nid_t *adc_nids;
245 hda_nid_t *capsrc_nids;
240 hda_nid_t dig_in_nid; /* digital-in NID; optional */ 246 hda_nid_t dig_in_nid; /* digital-in NID; optional */
241 247
242 /* capture source */ 248 /* capture source */
@@ -270,7 +276,6 @@ struct alc_spec {
270 276
271 /* for virtual master */ 277 /* for virtual master */
272 hda_nid_t vmaster_nid; 278 hda_nid_t vmaster_nid;
273 u32 vmaster_tlv[4];
274#ifdef CONFIG_SND_HDA_POWER_SAVE 279#ifdef CONFIG_SND_HDA_POWER_SAVE
275 struct hda_loopback_check loopback; 280 struct hda_loopback_check loopback;
276#endif 281#endif
@@ -290,6 +295,7 @@ struct alc_config_preset {
290 hda_nid_t hp_nid; /* optional */ 295 hda_nid_t hp_nid; /* optional */
291 unsigned int num_adc_nids; 296 unsigned int num_adc_nids;
292 hda_nid_t *adc_nids; 297 hda_nid_t *adc_nids;
298 hda_nid_t *capsrc_nids;
293 hda_nid_t dig_in_nid; 299 hda_nid_t dig_in_nid;
294 unsigned int num_channel_mode; 300 unsigned int num_channel_mode;
295 const struct hda_channel_mode *channel_mode; 301 const struct hda_channel_mode *channel_mode;
@@ -336,9 +342,10 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
336 struct alc_spec *spec = codec->spec; 342 struct alc_spec *spec = codec->spec;
337 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 343 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
338 unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; 344 unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
345 hda_nid_t nid = spec->capsrc_nids ?
346 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
339 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol, 347 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol,
340 spec->adc_nids[adc_idx], 348 nid, &spec->cur_mux[adc_idx]);
341 &spec->cur_mux[adc_idx]);
342} 349}
343 350
344 351
@@ -707,6 +714,7 @@ static void setup_preset(struct alc_spec *spec,
707 714
708 spec->num_adc_nids = preset->num_adc_nids; 715 spec->num_adc_nids = preset->num_adc_nids;
709 spec->adc_nids = preset->adc_nids; 716 spec->adc_nids = preset->adc_nids;
717 spec->capsrc_nids = preset->capsrc_nids;
710 spec->dig_in_nid = preset->dig_in_nid; 718 spec->dig_in_nid = preset->dig_in_nid;
711 719
712 spec->unsol_event = preset->unsol_event; 720 spec->unsol_event = preset->unsol_event;
@@ -741,7 +749,6 @@ static struct hda_verb alc_gpio3_init_verbs[] = {
741static void alc_sku_automute(struct hda_codec *codec) 749static void alc_sku_automute(struct hda_codec *codec)
742{ 750{
743 struct alc_spec *spec = codec->spec; 751 struct alc_spec *spec = codec->spec;
744 unsigned int mute;
745 unsigned int present; 752 unsigned int present;
746 unsigned int hp_nid = spec->autocfg.hp_pins[0]; 753 unsigned int hp_nid = spec->autocfg.hp_pins[0];
747 unsigned int sp_nid = spec->autocfg.speaker_pins[0]; 754 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
@@ -751,16 +758,8 @@ static void alc_sku_automute(struct hda_codec *codec)
751 present = snd_hda_codec_read(codec, hp_nid, 0, 758 present = snd_hda_codec_read(codec, hp_nid, 0,
752 AC_VERB_GET_PIN_SENSE, 0); 759 AC_VERB_GET_PIN_SENSE, 0);
753 spec->jack_present = (present & 0x80000000) != 0; 760 spec->jack_present = (present & 0x80000000) != 0;
754 if (spec->jack_present) { 761 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
755 /* mute internal speaker */ 762 spec->jack_present ? 0 : PIN_OUT);
756 snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0,
757 HDA_AMP_MUTE, HDA_AMP_MUTE);
758 } else {
759 /* unmute internal speaker if necessary */
760 mute = snd_hda_codec_amp_read(codec, hp_nid, 0, HDA_OUTPUT, 0);
761 snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0,
762 HDA_AMP_MUTE, mute);
763 }
764} 763}
765 764
766/* unsolicited event for HP jack sensing */ 765/* unsolicited event for HP jack sensing */
@@ -1319,11 +1318,19 @@ static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1319 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), 1318 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1320 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 1319 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1321 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 1320 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1322 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 1321 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1323 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 1322 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1324 { } /* end */ 1323 { } /* end */
1325}; 1324};
1326 1325
1326static struct hda_input_mux alc880_f1734_capture_source = {
1327 .num_items = 2,
1328 .items = {
1329 { "Mic", 0x1 },
1330 { "CD", 0x4 },
1331 },
1332};
1333
1327 1334
1328/* 1335/*
1329 * ALC880 ASUS model 1336 * ALC880 ASUS model
@@ -1516,6 +1523,11 @@ static int alc_build_controls(struct hda_codec *codec)
1516 spec->multiout.dig_out_nid); 1523 spec->multiout.dig_out_nid);
1517 if (err < 0) 1524 if (err < 0)
1518 return err; 1525 return err;
1526 err = snd_hda_create_spdif_share_sw(codec,
1527 &spec->multiout);
1528 if (err < 0)
1529 return err;
1530 spec->multiout.share_spdif = 1;
1519 } 1531 }
1520 if (spec->dig_in_nid) { 1532 if (spec->dig_in_nid) {
1521 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); 1533 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
@@ -1525,10 +1537,11 @@ static int alc_build_controls(struct hda_codec *codec)
1525 1537
1526 /* if we have no master control, let's create it */ 1538 /* if we have no master control, let's create it */
1527 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { 1539 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1540 unsigned int vmaster_tlv[4];
1528 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, 1541 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
1529 HDA_OUTPUT, spec->vmaster_tlv); 1542 HDA_OUTPUT, vmaster_tlv);
1530 err = snd_hda_add_vmaster(codec, "Master Playback Volume", 1543 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1531 spec->vmaster_tlv, alc_slave_vols); 1544 vmaster_tlv, alc_slave_vols);
1532 if (err < 0) 1545 if (err < 0)
1533 return err; 1546 return err;
1534 } 1547 }
@@ -1882,7 +1895,7 @@ static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
1882 present = snd_hda_codec_read(codec, 0x14, 0, 1895 present = snd_hda_codec_read(codec, 0x14, 0,
1883 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1896 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1884 bits = present ? HDA_AMP_MUTE : 0; 1897 bits = present ? HDA_AMP_MUTE : 0;
1885 snd_hda_codec_amp_stereo(codec, 0x15, HDA_INPUT, 0, HDA_AMP_MUTE, bits); 1898 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
1886} 1899}
1887 1900
1888static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) 1901static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
@@ -1915,6 +1928,7 @@ static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
1915 * HP = 0x14, speaker-out = 0x15, mic = 0x18 1928 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1916 */ 1929 */
1917static struct hda_verb alc880_pin_f1734_init_verbs[] = { 1930static struct hda_verb alc880_pin_f1734_init_verbs[] = {
1931 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
1918 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, 1932 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1919 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, 1933 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1920 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, 1934 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
@@ -1927,7 +1941,7 @@ static struct hda_verb alc880_pin_f1734_init_verbs[] = {
1927 1941
1928 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1942 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1929 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1943 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1930 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1944 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
1931 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1945 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1932 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1946 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1933 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1947 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
@@ -1935,6 +1949,9 @@ static struct hda_verb alc880_pin_f1734_init_verbs[] = {
1935 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1949 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1936 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1950 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1937 1951
1952 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
1953 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
1954
1938 { } 1955 { }
1939}; 1956};
1940 1957
@@ -2318,7 +2335,8 @@ static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2318 struct snd_pcm_substream *substream) 2335 struct snd_pcm_substream *substream)
2319{ 2336{
2320 struct alc_spec *spec = codec->spec; 2337 struct alc_spec *spec = codec->spec;
2321 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); 2338 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2339 hinfo);
2322} 2340}
2323 2341
2324static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, 2342static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
@@ -2392,8 +2410,8 @@ static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2392{ 2410{
2393 struct alc_spec *spec = codec->spec; 2411 struct alc_spec *spec = codec->spec;
2394 2412
2395 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], 2413 snd_hda_codec_cleanup_stream(codec,
2396 0, 0, 0); 2414 spec->adc_nids[substream->number + 1]);
2397 return 0; 2415 return 0;
2398} 2416}
2399 2417
@@ -2498,6 +2516,7 @@ static int alc_build_pcms(struct hda_codec *codec)
2498 codec->num_pcms = 2; 2516 codec->num_pcms = 2;
2499 info = spec->pcm_rec + 1; 2517 info = spec->pcm_rec + 1;
2500 info->name = spec->stream_name_digital; 2518 info->name = spec->stream_name_digital;
2519 info->pcm_type = HDA_PCM_TYPE_SPDIF;
2501 if (spec->multiout.dig_out_nid && 2520 if (spec->multiout.dig_out_nid &&
2502 spec->stream_digital_playback) { 2521 spec->stream_digital_playback) {
2503 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); 2522 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
@@ -2560,6 +2579,7 @@ static void alc_free(struct hda_codec *codec)
2560 kfree(spec->kctl_alloc); 2579 kfree(spec->kctl_alloc);
2561 } 2580 }
2562 kfree(spec); 2581 kfree(spec);
2582 codec->spec = NULL; /* to be sure */
2563} 2583}
2564 2584
2565/* 2585/*
@@ -3057,7 +3077,9 @@ static struct alc_config_preset alc880_presets[] = {
3057 .hp_nid = 0x02, 3077 .hp_nid = 0x02,
3058 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), 3078 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3059 .channel_mode = alc880_2_jack_modes, 3079 .channel_mode = alc880_2_jack_modes,
3060 .input_mux = &alc880_capture_source, 3080 .input_mux = &alc880_f1734_capture_source,
3081 .unsol_event = alc880_uniwill_p53_unsol_event,
3082 .init_hook = alc880_uniwill_p53_hp_automute,
3061 }, 3083 },
3062 [ALC880_ASUS] = { 3084 [ALC880_ASUS] = {
3063 .mixers = { alc880_asus_mixer }, 3085 .mixers = { alc880_asus_mixer },
@@ -3467,15 +3489,21 @@ static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3467 return 0; 3489 return 0;
3468} 3490}
3469 3491
3470static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, 3492static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
3471 hda_nid_t nid, int pin_type, 3493 unsigned int pin_type)
3472 int dac_idx)
3473{ 3494{
3474 /* set as output */
3475 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 3495 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3476 pin_type); 3496 pin_type);
3497 /* unmute pin */
3477 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, 3498 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3478 AMP_OUT_UNMUTE); 3499 AMP_OUT_UNMUTE);
3500}
3501
3502static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3503 hda_nid_t nid, int pin_type,
3504 int dac_idx)
3505{
3506 alc_set_pin_output(codec, nid, pin_type);
3479 /* need the manual connection? */ 3507 /* need the manual connection? */
3480 if (alc880_is_multi_pin(nid)) { 3508 if (alc880_is_multi_pin(nid)) {
3481 struct alc_spec *spec = codec->spec; 3509 struct alc_spec *spec = codec->spec;
@@ -3597,9 +3625,12 @@ static int alc880_parse_auto_config(struct hda_codec *codec)
3597/* additional initialization for auto-configuration model */ 3625/* additional initialization for auto-configuration model */
3598static void alc880_auto_init(struct hda_codec *codec) 3626static void alc880_auto_init(struct hda_codec *codec)
3599{ 3627{
3628 struct alc_spec *spec = codec->spec;
3600 alc880_auto_init_multi_out(codec); 3629 alc880_auto_init_multi_out(codec);
3601 alc880_auto_init_extra_out(codec); 3630 alc880_auto_init_extra_out(codec);
3602 alc880_auto_init_analog_input(codec); 3631 alc880_auto_init_analog_input(codec);
3632 if (spec->unsol_event)
3633 alc_sku_automute(codec);
3603} 3634}
3604 3635
3605/* 3636/*
@@ -4795,11 +4826,7 @@ static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
4795 hda_nid_t nid, int pin_type, 4826 hda_nid_t nid, int pin_type,
4796 int sel_idx) 4827 int sel_idx)
4797{ 4828{
4798 /* set as output */ 4829 alc_set_pin_output(codec, nid, pin_type);
4799 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4800 pin_type);
4801 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4802 AMP_OUT_UNMUTE);
4803 /* need the manual connection? */ 4830 /* need the manual connection? */
4804 if (nid >= 0x12) { 4831 if (nid >= 0x12) {
4805 int idx = nid - 0x12; 4832 int idx = nid - 0x12;
@@ -4929,7 +4956,7 @@ static int alc260_parse_auto_config(struct hda_codec *codec)
4929 /* check whether NID 0x04 is valid */ 4956 /* check whether NID 0x04 is valid */
4930 wcap = get_wcaps(codec, 0x04); 4957 wcap = get_wcaps(codec, 0x04);
4931 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ 4958 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
4932 if (wcap != AC_WID_AUD_IN) { 4959 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
4933 spec->adc_nids = alc260_adc_nids_alt; 4960 spec->adc_nids = alc260_adc_nids_alt;
4934 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); 4961 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
4935 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; 4962 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer;
@@ -4946,8 +4973,11 @@ static int alc260_parse_auto_config(struct hda_codec *codec)
4946/* additional initialization for auto-configuration model */ 4973/* additional initialization for auto-configuration model */
4947static void alc260_auto_init(struct hda_codec *codec) 4974static void alc260_auto_init(struct hda_codec *codec)
4948{ 4975{
4976 struct alc_spec *spec = codec->spec;
4949 alc260_auto_init_multi_out(codec); 4977 alc260_auto_init_multi_out(codec);
4950 alc260_auto_init_analog_input(codec); 4978 alc260_auto_init_analog_input(codec);
4979 if (spec->unsol_event)
4980 alc_sku_automute(codec);
4951} 4981}
4952 4982
4953#ifdef CONFIG_SND_HDA_POWER_SAVE 4983#ifdef CONFIG_SND_HDA_POWER_SAVE
@@ -5204,6 +5234,9 @@ static hda_nid_t alc882_dac_nids[4] = {
5204#define alc882_adc_nids alc880_adc_nids 5234#define alc882_adc_nids alc880_adc_nids
5205#define alc882_adc_nids_alt alc880_adc_nids_alt 5235#define alc882_adc_nids_alt alc880_adc_nids_alt
5206 5236
5237static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5238static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5239
5207/* input MUX */ 5240/* input MUX */
5208/* FIXME: should be a matrix-type input source selection */ 5241/* FIXME: should be a matrix-type input source selection */
5209 5242
@@ -5226,15 +5259,11 @@ static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
5226 struct alc_spec *spec = codec->spec; 5259 struct alc_spec *spec = codec->spec;
5227 const struct hda_input_mux *imux = spec->input_mux; 5260 const struct hda_input_mux *imux = spec->input_mux;
5228 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 5261 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5229 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; 5262 hda_nid_t nid = spec->capsrc_nids ?
5230 hda_nid_t nid; 5263 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
5231 unsigned int *cur_val = &spec->cur_mux[adc_idx]; 5264 unsigned int *cur_val = &spec->cur_mux[adc_idx];
5232 unsigned int i, idx; 5265 unsigned int i, idx;
5233 5266
5234 if (spec->num_adc_nids < 3)
5235 nid = capture_mixers[adc_idx + 1];
5236 else
5237 nid = capture_mixers[adc_idx];
5238 idx = ucontrol->value.enumerated.item[0]; 5267 idx = ucontrol->value.enumerated.item[0];
5239 if (idx >= imux->num_items) 5268 if (idx >= imux->num_items)
5240 idx = imux->num_items - 1; 5269 idx = imux->num_items - 1;
@@ -6111,6 +6140,7 @@ static struct alc_config_preset alc882_presets[] = {
6111 .dig_out_nid = ALC882_DIGOUT_NID, 6140 .dig_out_nid = ALC882_DIGOUT_NID,
6112 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), 6141 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6113 .adc_nids = alc882_adc_nids, 6142 .adc_nids = alc882_adc_nids,
6143 .capsrc_nids = alc882_capsrc_nids,
6114 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), 6144 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6115 .channel_mode = alc882_3ST_6ch_modes, 6145 .channel_mode = alc882_3ST_6ch_modes,
6116 .need_dac_fix = 1, 6146 .need_dac_fix = 1,
@@ -6127,6 +6157,7 @@ static struct alc_config_preset alc882_presets[] = {
6127 .dig_out_nid = ALC882_DIGOUT_NID, 6157 .dig_out_nid = ALC882_DIGOUT_NID,
6128 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), 6158 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6129 .adc_nids = alc882_adc_nids, 6159 .adc_nids = alc882_adc_nids,
6160 .capsrc_nids = alc882_capsrc_nids,
6130 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), 6161 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6131 .channel_mode = alc882_3ST_6ch_modes, 6162 .channel_mode = alc882_3ST_6ch_modes,
6132 .need_dac_fix = 1, 6163 .need_dac_fix = 1,
@@ -6182,15 +6213,11 @@ static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6182 struct alc_spec *spec = codec->spec; 6213 struct alc_spec *spec = codec->spec;
6183 int idx; 6214 int idx;
6184 6215
6216 alc_set_pin_output(codec, nid, pin_type);
6185 if (spec->multiout.dac_nids[dac_idx] == 0x25) 6217 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6186 idx = 4; 6218 idx = 4;
6187 else 6219 else
6188 idx = spec->multiout.dac_nids[dac_idx] - 2; 6220 idx = spec->multiout.dac_nids[dac_idx] - 2;
6189
6190 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6191 pin_type);
6192 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
6193 AMP_OUT_UNMUTE);
6194 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); 6221 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6195 6222
6196} 6223}
@@ -6219,6 +6246,9 @@ static void alc882_auto_init_hp_out(struct hda_codec *codec)
6219 if (pin) /* connect to front */ 6246 if (pin) /* connect to front */
6220 /* use dac 0 */ 6247 /* use dac 0 */
6221 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); 6248 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6249 pin = spec->autocfg.speaker_pins[0];
6250 if (pin)
6251 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6222} 6252}
6223 6253
6224#define alc882_is_input_pin(nid) alc880_is_input_pin(nid) 6254#define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
@@ -6231,16 +6261,21 @@ static void alc882_auto_init_analog_input(struct hda_codec *codec)
6231 6261
6232 for (i = 0; i < AUTO_PIN_LAST; i++) { 6262 for (i = 0; i < AUTO_PIN_LAST; i++) {
6233 hda_nid_t nid = spec->autocfg.input_pins[i]; 6263 hda_nid_t nid = spec->autocfg.input_pins[i];
6234 if (alc882_is_input_pin(nid)) { 6264 unsigned int vref;
6235 snd_hda_codec_write(codec, nid, 0, 6265 if (!nid)
6236 AC_VERB_SET_PIN_WIDGET_CONTROL, 6266 continue;
6237 i <= AUTO_PIN_FRONT_MIC ? 6267 vref = PIN_IN;
6238 PIN_VREF80 : PIN_IN); 6268 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6239 if (nid != ALC882_PIN_CD_NID) 6269 if (snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP) &
6240 snd_hda_codec_write(codec, nid, 0, 6270 AC_PINCAP_VREF_80)
6241 AC_VERB_SET_AMP_GAIN_MUTE, 6271 vref = PIN_VREF80;
6242 AMP_OUT_MUTE);
6243 } 6272 }
6273 snd_hda_codec_write(codec, nid, 0,
6274 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6275 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6276 snd_hda_codec_write(codec, nid, 0,
6277 AC_VERB_SET_AMP_GAIN_MUTE,
6278 AMP_OUT_MUTE);
6244 } 6279 }
6245} 6280}
6246 6281
@@ -6294,11 +6329,16 @@ static int alc882_parse_auto_config(struct hda_codec *codec)
6294/* additional initialization for auto-configuration model */ 6329/* additional initialization for auto-configuration model */
6295static void alc882_auto_init(struct hda_codec *codec) 6330static void alc882_auto_init(struct hda_codec *codec)
6296{ 6331{
6332 struct alc_spec *spec = codec->spec;
6297 alc882_auto_init_multi_out(codec); 6333 alc882_auto_init_multi_out(codec);
6298 alc882_auto_init_hp_out(codec); 6334 alc882_auto_init_hp_out(codec);
6299 alc882_auto_init_analog_input(codec); 6335 alc882_auto_init_analog_input(codec);
6336 if (spec->unsol_event)
6337 alc_sku_automute(codec);
6300} 6338}
6301 6339
6340static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
6341
6302static int patch_alc882(struct hda_codec *codec) 6342static int patch_alc882(struct hda_codec *codec)
6303{ 6343{
6304 struct alc_spec *spec; 6344 struct alc_spec *spec;
@@ -6328,6 +6368,11 @@ static int patch_alc882(struct hda_codec *codec)
6328 board_config = ALC885_MBP3; 6368 board_config = ALC885_MBP3;
6329 break; 6369 break;
6330 default: 6370 default:
6371 /* ALC889A is handled better as ALC888-compatible */
6372 if (codec->revision_id == 0x100103) {
6373 alc_free(codec);
6374 return patch_alc883(codec);
6375 }
6331 printk(KERN_INFO "hda_codec: Unknown model for ALC882, " 6376 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
6332 "trying auto-probe from BIOS...\n"); 6377 "trying auto-probe from BIOS...\n");
6333 board_config = ALC882_AUTO; 6378 board_config = ALC882_AUTO;
@@ -6372,12 +6417,14 @@ static int patch_alc882(struct hda_codec *codec)
6372 if (wcap != AC_WID_AUD_IN) { 6417 if (wcap != AC_WID_AUD_IN) {
6373 spec->adc_nids = alc882_adc_nids_alt; 6418 spec->adc_nids = alc882_adc_nids_alt;
6374 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); 6419 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6420 spec->capsrc_nids = alc882_capsrc_nids_alt;
6375 spec->mixers[spec->num_mixers] = 6421 spec->mixers[spec->num_mixers] =
6376 alc882_capture_alt_mixer; 6422 alc882_capture_alt_mixer;
6377 spec->num_mixers++; 6423 spec->num_mixers++;
6378 } else { 6424 } else {
6379 spec->adc_nids = alc882_adc_nids; 6425 spec->adc_nids = alc882_adc_nids;
6380 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); 6426 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6427 spec->capsrc_nids = alc882_capsrc_nids;
6381 spec->mixers[spec->num_mixers] = alc882_capture_mixer; 6428 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
6382 spec->num_mixers++; 6429 spec->num_mixers++;
6383 } 6430 }
@@ -6412,7 +6459,7 @@ static int patch_alc882(struct hda_codec *codec)
6412 6459
6413static hda_nid_t alc883_dac_nids[4] = { 6460static hda_nid_t alc883_dac_nids[4] = {
6414 /* front, rear, clfe, rear_surr */ 6461 /* front, rear, clfe, rear_surr */
6415 0x02, 0x04, 0x03, 0x05 6462 0x02, 0x03, 0x04, 0x05
6416}; 6463};
6417 6464
6418static hda_nid_t alc883_adc_nids[2] = { 6465static hda_nid_t alc883_adc_nids[2] = {
@@ -6420,6 +6467,8 @@ static hda_nid_t alc883_adc_nids[2] = {
6420 0x08, 0x09, 6467 0x08, 0x09,
6421}; 6468};
6422 6469
6470static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
6471
6423/* input MUX */ 6472/* input MUX */
6424/* FIXME: should be a matrix-type input source selection */ 6473/* FIXME: should be a matrix-type input source selection */
6425 6474
@@ -6451,35 +6500,18 @@ static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6451 }, 6500 },
6452}; 6501};
6453 6502
6503static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6504 .num_items = 2,
6505 .items = {
6506 { "Mic", 0x0 },
6507 { "Int Mic", 0x1 },
6508 },
6509};
6510
6454#define alc883_mux_enum_info alc_mux_enum_info 6511#define alc883_mux_enum_info alc_mux_enum_info
6455#define alc883_mux_enum_get alc_mux_enum_get 6512#define alc883_mux_enum_get alc_mux_enum_get
6456 6513/* ALC883 has the ALC882-type input selection */
6457static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol, 6514#define alc883_mux_enum_put alc882_mux_enum_put
6458 struct snd_ctl_elem_value *ucontrol)
6459{
6460 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
6461 struct alc_spec *spec = codec->spec;
6462 const struct hda_input_mux *imux = spec->input_mux;
6463 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
6464 static hda_nid_t capture_mixers[2] = { 0x23, 0x22 };
6465 hda_nid_t nid = capture_mixers[adc_idx];
6466 unsigned int *cur_val = &spec->cur_mux[adc_idx];
6467 unsigned int i, idx;
6468
6469 idx = ucontrol->value.enumerated.item[0];
6470 if (idx >= imux->num_items)
6471 idx = imux->num_items - 1;
6472 if (*cur_val == idx)
6473 return 0;
6474 for (i = 0; i < imux->num_items; i++) {
6475 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
6476 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
6477 imux->items[i].index,
6478 HDA_AMP_MUTE, v);
6479 }
6480 *cur_val = idx;
6481 return 1;
6482}
6483 6515
6484/* 6516/*
6485 * 2ch mode 6517 * 2ch mode
@@ -6638,6 +6670,60 @@ static struct snd_kcontrol_new alc883_mitac_mixer[] = {
6638 { } /* end */ 6670 { } /* end */
6639}; 6671};
6640 6672
6673static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
6674 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6675 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
6676 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6677 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6678 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6679 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6680 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6681 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6682 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6683 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6684 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6685 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6686 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6687 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6688 {
6689 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6690 /* .name = "Capture Source", */
6691 .name = "Input Source",
6692 .count = 2,
6693 .info = alc883_mux_enum_info,
6694 .get = alc883_mux_enum_get,
6695 .put = alc883_mux_enum_put,
6696 },
6697 { } /* end */
6698};
6699
6700static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
6701 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6702 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
6703 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6704 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6705 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6706 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6707 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6708 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6709 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6710 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6711 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6712 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6713 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6714 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6715 {
6716 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6717 /* .name = "Capture Source", */
6718 .name = "Input Source",
6719 .count = 2,
6720 .info = alc883_mux_enum_info,
6721 .get = alc883_mux_enum_get,
6722 .put = alc883_mux_enum_put,
6723 },
6724 { } /* end */
6725};
6726
6641static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { 6727static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
6642 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 6728 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6643 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 6729 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
@@ -6787,6 +6873,9 @@ static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
6787 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 6873 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6788 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 6874 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6789 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 6875 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6876 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6877 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6878 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6790 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 6879 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6791 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 6880 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6792 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), 6881 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
@@ -6878,124 +6967,6 @@ static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
6878 { } /* end */ 6967 { } /* end */
6879}; 6968};
6880 6969
6881static struct snd_kcontrol_new alc888_6st_hp_mixer[] = {
6882 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6883 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6884 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6885 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6886 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6887 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6888 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6889 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6890 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6891 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6892 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6893 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6894 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6895 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6896 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6897 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6898 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6899 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6900 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6901 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6902 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6903 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6904 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6905 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6906 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6907 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6908 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6909 {
6910 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6911 /* .name = "Capture Source", */
6912 .name = "Input Source",
6913 .count = 2,
6914 .info = alc883_mux_enum_info,
6915 .get = alc883_mux_enum_get,
6916 .put = alc883_mux_enum_put,
6917 },
6918 { } /* end */
6919};
6920
6921static struct snd_kcontrol_new alc888_3st_hp_mixer[] = {
6922 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6923 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6924 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6925 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6926 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6927 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6928 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6929 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6930 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6931 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6932 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6933 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6934 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6935 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6936 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6937 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6938 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6939 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6940 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6941 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6942 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6943 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6944 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6945 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6946 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6947 {
6948 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6949 /* .name = "Capture Source", */
6950 .name = "Input Source",
6951 .count = 2,
6952 .info = alc883_mux_enum_info,
6953 .get = alc883_mux_enum_get,
6954 .put = alc883_mux_enum_put,
6955 },
6956 { } /* end */
6957};
6958
6959static struct snd_kcontrol_new alc888_6st_dell_mixer[] = {
6960 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6961 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6962 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6963 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6964 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6965 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6966 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6967 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6968 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6969 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6970 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6971 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6972 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6973 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6974 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6975 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6976 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6977 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6978 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6979 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6980 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6981 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6982 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6983 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6984 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6985 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6986 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6987 {
6988 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6989 /* .name = "Capture Source", */
6990 .name = "Input Source",
6991 .count = 2,
6992 .info = alc883_mux_enum_info,
6993 .get = alc883_mux_enum_get,
6994 .put = alc883_mux_enum_put,
6995 },
6996 { } /* end */
6997};
6998
6999static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { 6970static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7000 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 6971 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7001 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 6972 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
@@ -7171,6 +7142,35 @@ static struct hda_verb alc883_mitac_verbs[] = {
7171 { } /* end */ 7142 { } /* end */
7172}; 7143};
7173 7144
7145static struct hda_verb alc883_clevo_m720_verbs[] = {
7146 /* HP */
7147 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7148 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7149 /* Int speaker */
7150 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7151 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7152
7153 /* enable unsolicited event */
7154 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7155 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7156
7157 { } /* end */
7158};
7159
7160static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7161 /* HP */
7162 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7163 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7164 /* Subwoofer */
7165 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7166 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7167
7168 /* enable unsolicited event */
7169 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7170
7171 { } /* end */
7172};
7173
7174static struct hda_verb alc883_tagra_verbs[] = { 7174static struct hda_verb alc883_tagra_verbs[] = {
7175 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7175 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7176 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7176 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
@@ -7227,26 +7227,14 @@ static struct hda_verb alc883_haier_w66_verbs[] = {
7227 { } /* end */ 7227 { } /* end */
7228}; 7228};
7229 7229
7230static struct hda_verb alc888_6st_hp_verbs[] = {
7231 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7232 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */
7233 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */
7234 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */
7235 { }
7236};
7237
7238static struct hda_verb alc888_3st_hp_verbs[] = { 7230static struct hda_verb alc888_3st_hp_verbs[] = {
7239 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ 7231 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7240 {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ 7232 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7241 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ 7233 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7242 { } 7234 { }
7243}; 7235};
7244 7236
7245static struct hda_verb alc888_6st_dell_verbs[] = { 7237static struct hda_verb alc888_6st_dell_verbs[] = {
7246 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7247 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 1 (0x0e) */
7248 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 2 (0x0d) */
7249 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */
7250 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 7238 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7251 { } 7239 { }
7252}; 7240};
@@ -7354,6 +7342,68 @@ static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7354 alc883_tagra_automute(codec); 7342 alc883_tagra_automute(codec);
7355} 7343}
7356 7344
7345/* toggle speaker-output according to the hp-jack state */
7346static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
7347{
7348 unsigned int present;
7349 unsigned char bits;
7350
7351 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
7352 & AC_PINSENSE_PRESENCE;
7353 bits = present ? HDA_AMP_MUTE : 0;
7354 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7355 HDA_AMP_MUTE, bits);
7356}
7357
7358static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
7359{
7360 unsigned int present;
7361
7362 present = snd_hda_codec_read(codec, 0x18, 0,
7363 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7364 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
7365 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7366}
7367
7368static void alc883_clevo_m720_automute(struct hda_codec *codec)
7369{
7370 alc883_clevo_m720_hp_automute(codec);
7371 alc883_clevo_m720_mic_automute(codec);
7372}
7373
7374static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
7375 unsigned int res)
7376{
7377 switch (res >> 26) {
7378 case ALC880_HP_EVENT:
7379 alc883_clevo_m720_hp_automute(codec);
7380 break;
7381 case ALC880_MIC_EVENT:
7382 alc883_clevo_m720_mic_automute(codec);
7383 break;
7384 }
7385}
7386
7387/* toggle speaker-output according to the hp-jack state */
7388static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
7389{
7390 unsigned int present;
7391 unsigned char bits;
7392
7393 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
7394 & AC_PINSENSE_PRESENCE;
7395 bits = present ? HDA_AMP_MUTE : 0;
7396 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7397 HDA_AMP_MUTE, bits);
7398}
7399
7400static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
7401 unsigned int res)
7402{
7403 if ((res >> 26) == ALC880_HP_EVENT)
7404 alc883_2ch_fujitsu_pi2515_automute(codec);
7405}
7406
7357static void alc883_haier_w66_automute(struct hda_codec *codec) 7407static void alc883_haier_w66_automute(struct hda_codec *codec)
7358{ 7408{
7359 unsigned int present; 7409 unsigned int present;
@@ -7587,10 +7637,11 @@ static const char *alc883_models[ALC883_MODEL_LAST] = {
7587 [ALC883_LENOVO_NB0763] = "lenovo-nb0763", 7637 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
7588 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", 7638 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
7589 [ALC883_HAIER_W66] = "haier-w66", 7639 [ALC883_HAIER_W66] = "haier-w66",
7590 [ALC888_6ST_HP] = "6stack-hp",
7591 [ALC888_3ST_HP] = "3stack-hp", 7640 [ALC888_3ST_HP] = "3stack-hp",
7592 [ALC888_6ST_DELL] = "6stack-dell", 7641 [ALC888_6ST_DELL] = "6stack-dell",
7593 [ALC883_MITAC] = "mitac", 7642 [ALC883_MITAC] = "mitac",
7643 [ALC883_CLEVO_M720] = "clevo-m720",
7644 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
7594 [ALC883_AUTO] = "auto", 7645 [ALC883_AUTO] = "auto",
7595}; 7646};
7596 7647
@@ -7604,7 +7655,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
7604 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), 7655 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
7605 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), 7656 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
7606 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), 7657 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
7607 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP), 7658 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
7608 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), 7659 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
7609 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), 7660 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
7610 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), 7661 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
@@ -7614,7 +7665,9 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
7614 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), 7665 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
7615 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), 7666 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
7616 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), 7667 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
7668 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
7617 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), 7669 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
7670 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
7618 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), 7671 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
7619 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), 7672 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
7620 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), 7673 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
@@ -7627,13 +7680,17 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
7627 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), 7680 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
7628 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), 7681 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
7629 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), 7682 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
7683 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
7630 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), 7684 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
7631 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), 7685 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
7632 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), 7686 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
7633 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), 7687 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
7688 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
7689 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
7634 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), 7690 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
7635 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), 7691 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
7636 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), 7692 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
7693 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
7637 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), 7694 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
7638 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), 7695 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7639 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), 7696 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
@@ -7652,8 +7709,6 @@ static struct alc_config_preset alc883_presets[] = {
7652 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7709 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7653 .dac_nids = alc883_dac_nids, 7710 .dac_nids = alc883_dac_nids,
7654 .dig_out_nid = ALC883_DIGOUT_NID, 7711 .dig_out_nid = ALC883_DIGOUT_NID,
7655 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7656 .adc_nids = alc883_adc_nids,
7657 .dig_in_nid = ALC883_DIGIN_NID, 7712 .dig_in_nid = ALC883_DIGIN_NID,
7658 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 7713 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7659 .channel_mode = alc883_3ST_2ch_modes, 7714 .channel_mode = alc883_3ST_2ch_modes,
@@ -7665,8 +7720,6 @@ static struct alc_config_preset alc883_presets[] = {
7665 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7720 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7666 .dac_nids = alc883_dac_nids, 7721 .dac_nids = alc883_dac_nids,
7667 .dig_out_nid = ALC883_DIGOUT_NID, 7722 .dig_out_nid = ALC883_DIGOUT_NID,
7668 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7669 .adc_nids = alc883_adc_nids,
7670 .dig_in_nid = ALC883_DIGIN_NID, 7723 .dig_in_nid = ALC883_DIGIN_NID,
7671 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), 7724 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7672 .channel_mode = alc883_3ST_6ch_modes, 7725 .channel_mode = alc883_3ST_6ch_modes,
@@ -7678,8 +7731,6 @@ static struct alc_config_preset alc883_presets[] = {
7678 .init_verbs = { alc883_init_verbs }, 7731 .init_verbs = { alc883_init_verbs },
7679 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7732 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7680 .dac_nids = alc883_dac_nids, 7733 .dac_nids = alc883_dac_nids,
7681 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7682 .adc_nids = alc883_adc_nids,
7683 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), 7734 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7684 .channel_mode = alc883_3ST_6ch_modes, 7735 .channel_mode = alc883_3ST_6ch_modes,
7685 .need_dac_fix = 1, 7736 .need_dac_fix = 1,
@@ -7691,8 +7742,6 @@ static struct alc_config_preset alc883_presets[] = {
7691 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7742 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7692 .dac_nids = alc883_dac_nids, 7743 .dac_nids = alc883_dac_nids,
7693 .dig_out_nid = ALC883_DIGOUT_NID, 7744 .dig_out_nid = ALC883_DIGOUT_NID,
7694 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7695 .adc_nids = alc883_adc_nids,
7696 .dig_in_nid = ALC883_DIGIN_NID, 7745 .dig_in_nid = ALC883_DIGIN_NID,
7697 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), 7746 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7698 .channel_mode = alc883_sixstack_modes, 7747 .channel_mode = alc883_sixstack_modes,
@@ -7704,8 +7753,6 @@ static struct alc_config_preset alc883_presets[] = {
7704 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7753 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7705 .dac_nids = alc883_dac_nids, 7754 .dac_nids = alc883_dac_nids,
7706 .dig_out_nid = ALC883_DIGOUT_NID, 7755 .dig_out_nid = ALC883_DIGOUT_NID,
7707 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7708 .adc_nids = alc883_adc_nids,
7709 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), 7756 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7710 .channel_mode = alc883_3ST_6ch_modes, 7757 .channel_mode = alc883_3ST_6ch_modes,
7711 .need_dac_fix = 1, 7758 .need_dac_fix = 1,
@@ -7719,8 +7766,6 @@ static struct alc_config_preset alc883_presets[] = {
7719 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7766 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7720 .dac_nids = alc883_dac_nids, 7767 .dac_nids = alc883_dac_nids,
7721 .dig_out_nid = ALC883_DIGOUT_NID, 7768 .dig_out_nid = ALC883_DIGOUT_NID,
7722 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7723 .adc_nids = alc883_adc_nids,
7724 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 7769 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7725 .channel_mode = alc883_3ST_2ch_modes, 7770 .channel_mode = alc883_3ST_2ch_modes,
7726 .input_mux = &alc883_capture_source, 7771 .input_mux = &alc883_capture_source,
@@ -7737,8 +7782,6 @@ static struct alc_config_preset alc883_presets[] = {
7737 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, 7782 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
7738 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7783 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7739 .dac_nids = alc883_dac_nids, 7784 .dac_nids = alc883_dac_nids,
7740 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7741 .adc_nids = alc883_adc_nids,
7742 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 7785 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7743 .channel_mode = alc883_3ST_2ch_modes, 7786 .channel_mode = alc883_3ST_2ch_modes,
7744 .input_mux = &alc883_capture_source, 7787 .input_mux = &alc883_capture_source,
@@ -7749,8 +7792,6 @@ static struct alc_config_preset alc883_presets[] = {
7749 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7792 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7750 .dac_nids = alc883_dac_nids, 7793 .dac_nids = alc883_dac_nids,
7751 .dig_out_nid = ALC883_DIGOUT_NID, 7794 .dig_out_nid = ALC883_DIGOUT_NID,
7752 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7753 .adc_nids = alc883_adc_nids,
7754 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 7795 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7755 .channel_mode = alc883_3ST_2ch_modes, 7796 .channel_mode = alc883_3ST_2ch_modes,
7756 .input_mux = &alc883_capture_source, 7797 .input_mux = &alc883_capture_source,
@@ -7764,8 +7805,6 @@ static struct alc_config_preset alc883_presets[] = {
7764 alc883_medion_eapd_verbs }, 7805 alc883_medion_eapd_verbs },
7765 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7806 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7766 .dac_nids = alc883_dac_nids, 7807 .dac_nids = alc883_dac_nids,
7767 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7768 .adc_nids = alc883_adc_nids,
7769 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), 7808 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7770 .channel_mode = alc883_sixstack_modes, 7809 .channel_mode = alc883_sixstack_modes,
7771 .input_mux = &alc883_capture_source, 7810 .input_mux = &alc883_capture_source,
@@ -7776,8 +7815,6 @@ static struct alc_config_preset alc883_presets[] = {
7776 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7815 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7777 .dac_nids = alc883_dac_nids, 7816 .dac_nids = alc883_dac_nids,
7778 .dig_out_nid = ALC883_DIGOUT_NID, 7817 .dig_out_nid = ALC883_DIGOUT_NID,
7779 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7780 .adc_nids = alc883_adc_nids,
7781 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 7818 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7782 .channel_mode = alc883_3ST_2ch_modes, 7819 .channel_mode = alc883_3ST_2ch_modes,
7783 .input_mux = &alc883_capture_source, 7820 .input_mux = &alc883_capture_source,
@@ -7789,19 +7826,27 @@ static struct alc_config_preset alc883_presets[] = {
7789 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, 7826 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
7790 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7827 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7791 .dac_nids = alc883_dac_nids, 7828 .dac_nids = alc883_dac_nids,
7792 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7793 .adc_nids = alc883_adc_nids,
7794 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 7829 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7795 .channel_mode = alc883_3ST_2ch_modes, 7830 .channel_mode = alc883_3ST_2ch_modes,
7796 .input_mux = &alc883_capture_source, 7831 .input_mux = &alc883_capture_source,
7797 }, 7832 },
7833 [ALC883_CLEVO_M720] = {
7834 .mixers = { alc883_clevo_m720_mixer },
7835 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
7836 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7837 .dac_nids = alc883_dac_nids,
7838 .dig_out_nid = ALC883_DIGOUT_NID,
7839 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7840 .channel_mode = alc883_3ST_2ch_modes,
7841 .input_mux = &alc883_capture_source,
7842 .unsol_event = alc883_clevo_m720_unsol_event,
7843 .init_hook = alc883_clevo_m720_automute,
7844 },
7798 [ALC883_LENOVO_101E_2ch] = { 7845 [ALC883_LENOVO_101E_2ch] = {
7799 .mixers = { alc883_lenovo_101e_2ch_mixer}, 7846 .mixers = { alc883_lenovo_101e_2ch_mixer},
7800 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, 7847 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
7801 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7848 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7802 .dac_nids = alc883_dac_nids, 7849 .dac_nids = alc883_dac_nids,
7803 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7804 .adc_nids = alc883_adc_nids,
7805 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 7850 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7806 .channel_mode = alc883_3ST_2ch_modes, 7851 .channel_mode = alc883_3ST_2ch_modes,
7807 .input_mux = &alc883_lenovo_101e_capture_source, 7852 .input_mux = &alc883_lenovo_101e_capture_source,
@@ -7813,8 +7858,6 @@ static struct alc_config_preset alc883_presets[] = {
7813 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, 7858 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
7814 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7859 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7815 .dac_nids = alc883_dac_nids, 7860 .dac_nids = alc883_dac_nids,
7816 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7817 .adc_nids = alc883_adc_nids,
7818 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 7861 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7819 .channel_mode = alc883_3ST_2ch_modes, 7862 .channel_mode = alc883_3ST_2ch_modes,
7820 .need_dac_fix = 1, 7863 .need_dac_fix = 1,
@@ -7828,8 +7871,6 @@ static struct alc_config_preset alc883_presets[] = {
7828 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7871 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7829 .dac_nids = alc883_dac_nids, 7872 .dac_nids = alc883_dac_nids,
7830 .dig_out_nid = ALC883_DIGOUT_NID, 7873 .dig_out_nid = ALC883_DIGOUT_NID,
7831 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7832 .adc_nids = alc883_adc_nids,
7833 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), 7874 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7834 .channel_mode = alc883_3ST_6ch_modes, 7875 .channel_mode = alc883_3ST_6ch_modes,
7835 .need_dac_fix = 1, 7876 .need_dac_fix = 1,
@@ -7843,47 +7884,28 @@ static struct alc_config_preset alc883_presets[] = {
7843 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7884 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7844 .dac_nids = alc883_dac_nids, 7885 .dac_nids = alc883_dac_nids,
7845 .dig_out_nid = ALC883_DIGOUT_NID, 7886 .dig_out_nid = ALC883_DIGOUT_NID,
7846 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7847 .adc_nids = alc883_adc_nids,
7848 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 7887 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7849 .channel_mode = alc883_3ST_2ch_modes, 7888 .channel_mode = alc883_3ST_2ch_modes,
7850 .input_mux = &alc883_capture_source, 7889 .input_mux = &alc883_capture_source,
7851 .unsol_event = alc883_haier_w66_unsol_event, 7890 .unsol_event = alc883_haier_w66_unsol_event,
7852 .init_hook = alc883_haier_w66_automute, 7891 .init_hook = alc883_haier_w66_automute,
7853 },
7854 [ALC888_6ST_HP] = {
7855 .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer },
7856 .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs },
7857 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7858 .dac_nids = alc883_dac_nids,
7859 .dig_out_nid = ALC883_DIGOUT_NID,
7860 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7861 .adc_nids = alc883_adc_nids,
7862 .dig_in_nid = ALC883_DIGIN_NID,
7863 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7864 .channel_mode = alc883_sixstack_modes,
7865 .input_mux = &alc883_capture_source,
7866 }, 7892 },
7867 [ALC888_3ST_HP] = { 7893 [ALC888_3ST_HP] = {
7868 .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer }, 7894 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7869 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, 7895 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
7870 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7896 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7871 .dac_nids = alc883_dac_nids, 7897 .dac_nids = alc883_dac_nids,
7872 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7873 .adc_nids = alc883_adc_nids,
7874 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), 7898 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
7875 .channel_mode = alc888_3st_hp_modes, 7899 .channel_mode = alc888_3st_hp_modes,
7876 .need_dac_fix = 1, 7900 .need_dac_fix = 1,
7877 .input_mux = &alc883_capture_source, 7901 .input_mux = &alc883_capture_source,
7878 }, 7902 },
7879 [ALC888_6ST_DELL] = { 7903 [ALC888_6ST_DELL] = {
7880 .mixers = { alc888_6st_dell_mixer, alc883_chmode_mixer }, 7904 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
7881 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, 7905 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
7882 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7906 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7883 .dac_nids = alc883_dac_nids, 7907 .dac_nids = alc883_dac_nids,
7884 .dig_out_nid = ALC883_DIGOUT_NID, 7908 .dig_out_nid = ALC883_DIGOUT_NID,
7885 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7886 .adc_nids = alc883_adc_nids,
7887 .dig_in_nid = ALC883_DIGIN_NID, 7909 .dig_in_nid = ALC883_DIGIN_NID,
7888 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), 7910 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7889 .channel_mode = alc883_sixstack_modes, 7911 .channel_mode = alc883_sixstack_modes,
@@ -7896,14 +7918,25 @@ static struct alc_config_preset alc883_presets[] = {
7896 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, 7918 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
7897 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 7919 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7898 .dac_nids = alc883_dac_nids, 7920 .dac_nids = alc883_dac_nids,
7899 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7900 .adc_nids = alc883_adc_nids,
7901 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 7921 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7902 .channel_mode = alc883_3ST_2ch_modes, 7922 .channel_mode = alc883_3ST_2ch_modes,
7903 .input_mux = &alc883_capture_source, 7923 .input_mux = &alc883_capture_source,
7904 .unsol_event = alc883_mitac_unsol_event, 7924 .unsol_event = alc883_mitac_unsol_event,
7905 .init_hook = alc883_mitac_automute, 7925 .init_hook = alc883_mitac_automute,
7906 }, 7926 },
7927 [ALC883_FUJITSU_PI2515] = {
7928 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
7929 .init_verbs = { alc883_init_verbs,
7930 alc883_2ch_fujitsu_pi2515_verbs},
7931 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7932 .dac_nids = alc883_dac_nids,
7933 .dig_out_nid = ALC883_DIGOUT_NID,
7934 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7935 .channel_mode = alc883_3ST_2ch_modes,
7936 .input_mux = &alc883_fujitsu_pi2515_capture_source,
7937 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
7938 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
7939 },
7907}; 7940};
7908 7941
7909 7942
@@ -7918,15 +7951,11 @@ static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
7918 struct alc_spec *spec = codec->spec; 7951 struct alc_spec *spec = codec->spec;
7919 int idx; 7952 int idx;
7920 7953
7954 alc_set_pin_output(codec, nid, pin_type);
7921 if (spec->multiout.dac_nids[dac_idx] == 0x25) 7955 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7922 idx = 4; 7956 idx = 4;
7923 else 7957 else
7924 idx = spec->multiout.dac_nids[dac_idx] - 2; 7958 idx = spec->multiout.dac_nids[dac_idx] - 2;
7925
7926 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7927 pin_type);
7928 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
7929 AMP_OUT_UNMUTE);
7930 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); 7959 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7931 7960
7932} 7961}
@@ -7955,6 +7984,9 @@ static void alc883_auto_init_hp_out(struct hda_codec *codec)
7955 if (pin) /* connect to front */ 7984 if (pin) /* connect to front */
7956 /* use dac 0 */ 7985 /* use dac 0 */
7957 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); 7986 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7987 pin = spec->autocfg.speaker_pins[0];
7988 if (pin)
7989 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
7958} 7990}
7959 7991
7960#define alc883_is_input_pin(nid) alc880_is_input_pin(nid) 7992#define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
@@ -8006,9 +8038,12 @@ static int alc883_parse_auto_config(struct hda_codec *codec)
8006/* additional initialization for auto-configuration model */ 8038/* additional initialization for auto-configuration model */
8007static void alc883_auto_init(struct hda_codec *codec) 8039static void alc883_auto_init(struct hda_codec *codec)
8008{ 8040{
8041 struct alc_spec *spec = codec->spec;
8009 alc883_auto_init_multi_out(codec); 8042 alc883_auto_init_multi_out(codec);
8010 alc883_auto_init_hp_out(codec); 8043 alc883_auto_init_hp_out(codec);
8011 alc883_auto_init_analog_input(codec); 8044 alc883_auto_init_analog_input(codec);
8045 if (spec->unsol_event)
8046 alc_sku_automute(codec);
8012} 8047}
8013 8048
8014static int patch_alc883(struct hda_codec *codec) 8049static int patch_alc883(struct hda_codec *codec)
@@ -8057,10 +8092,9 @@ static int patch_alc883(struct hda_codec *codec)
8057 spec->stream_digital_playback = &alc883_pcm_digital_playback; 8092 spec->stream_digital_playback = &alc883_pcm_digital_playback;
8058 spec->stream_digital_capture = &alc883_pcm_digital_capture; 8093 spec->stream_digital_capture = &alc883_pcm_digital_capture;
8059 8094
8060 if (!spec->adc_nids && spec->input_mux) { 8095 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
8061 spec->adc_nids = alc883_adc_nids; 8096 spec->adc_nids = alc883_adc_nids;
8062 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); 8097 spec->capsrc_nids = alc883_capsrc_nids;
8063 }
8064 8098
8065 spec->vmaster_nid = 0x0c; 8099 spec->vmaster_nid = 0x0c;
8066 8100
@@ -8085,6 +8119,8 @@ static int patch_alc883(struct hda_codec *codec)
8085#define alc262_dac_nids alc260_dac_nids 8119#define alc262_dac_nids alc260_dac_nids
8086#define alc262_adc_nids alc882_adc_nids 8120#define alc262_adc_nids alc882_adc_nids
8087#define alc262_adc_nids_alt alc882_adc_nids_alt 8121#define alc262_adc_nids_alt alc882_adc_nids_alt
8122#define alc262_capsrc_nids alc882_capsrc_nids
8123#define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
8088 8124
8089#define alc262_modes alc260_modes 8125#define alc262_modes alc260_modes
8090#define alc262_capture_source alc882_capture_source 8126#define alc262_capture_source alc882_capture_source
@@ -8585,7 +8621,8 @@ static void alc262_hippo1_unsol_event(struct hda_codec *codec,
8585 8621
8586/* 8622/*
8587 * fujitsu model 8623 * fujitsu model
8588 * 0x14 = headphone/spdif-out, 0x15 = internal speaker 8624 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
8625 * 0x1b = port replicator headphone out
8589 */ 8626 */
8590 8627
8591#define ALC_HP_EVENT 0x37 8628#define ALC_HP_EVENT 0x37
@@ -8593,6 +8630,14 @@ static void alc262_hippo1_unsol_event(struct hda_codec *codec,
8593static struct hda_verb alc262_fujitsu_unsol_verbs[] = { 8630static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
8594 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, 8631 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8595 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 8632 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8633 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8634 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8635 {}
8636};
8637
8638static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
8639 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8640 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8596 {} 8641 {}
8597}; 8642};
8598 8643
@@ -8633,12 +8678,16 @@ static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
8633 unsigned int mute; 8678 unsigned int mute;
8634 8679
8635 if (force || !spec->sense_updated) { 8680 if (force || !spec->sense_updated) {
8636 unsigned int present; 8681 unsigned int present_int_hp, present_dock_hp;
8637 /* need to execute and sync at first */ 8682 /* need to execute and sync at first */
8638 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); 8683 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
8639 present = snd_hda_codec_read(codec, 0x14, 0, 8684 present_int_hp = snd_hda_codec_read(codec, 0x14, 0,
8640 AC_VERB_GET_PIN_SENSE, 0); 8685 AC_VERB_GET_PIN_SENSE, 0);
8641 spec->jack_present = (present & 0x80000000) != 0; 8686 snd_hda_codec_read(codec, 0x1B, 0, AC_VERB_SET_PIN_SENSE, 0);
8687 present_dock_hp = snd_hda_codec_read(codec, 0x1b, 0,
8688 AC_VERB_GET_PIN_SENSE, 0);
8689 spec->jack_present = (present_int_hp & 0x80000000) != 0;
8690 spec->jack_present |= (present_dock_hp & 0x80000000) != 0;
8642 spec->sense_updated = 1; 8691 spec->sense_updated = 1;
8643 } 8692 }
8644 if (spec->jack_present) { 8693 if (spec->jack_present) {
@@ -8672,6 +8721,46 @@ static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
8672 }, 8721 },
8673}; 8722};
8674 8723
8724/* mute/unmute internal speaker according to the hp jack and mute state */
8725static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
8726{
8727 struct alc_spec *spec = codec->spec;
8728 unsigned int mute;
8729
8730 if (force || !spec->sense_updated) {
8731 unsigned int present_int_hp;
8732 /* need to execute and sync at first */
8733 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8734 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
8735 AC_VERB_GET_PIN_SENSE, 0);
8736 spec->jack_present = (present_int_hp & 0x80000000) != 0;
8737 spec->sense_updated = 1;
8738 }
8739 if (spec->jack_present) {
8740 /* mute internal speaker */
8741 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8742 HDA_AMP_MUTE, HDA_AMP_MUTE);
8743 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8744 HDA_AMP_MUTE, HDA_AMP_MUTE);
8745 } else {
8746 /* unmute internal speaker if necessary */
8747 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8748 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8749 HDA_AMP_MUTE, mute);
8750 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8751 HDA_AMP_MUTE, mute);
8752 }
8753}
8754
8755/* unsolicited event for HP jack sensing */
8756static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
8757 unsigned int res)
8758{
8759 if ((res >> 26) != ALC_HP_EVENT)
8760 return;
8761 alc262_lenovo_3000_automute(codec, 1);
8762}
8763
8675/* bind hp and internal speaker mute (with plug check) */ 8764/* bind hp and internal speaker mute (with plug check) */
8676static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, 8765static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
8677 struct snd_ctl_elem_value *ucontrol) 8766 struct snd_ctl_elem_value *ucontrol)
@@ -8680,12 +8769,13 @@ static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
8680 long *valp = ucontrol->value.integer.value; 8769 long *valp = ucontrol->value.integer.value;
8681 int change; 8770 int change;
8682 8771
8683 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 8772 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8684 HDA_AMP_MUTE, 8773 HDA_AMP_MUTE,
8685 valp[0] ? 0 : HDA_AMP_MUTE); 8774 valp ? 0 : HDA_AMP_MUTE);
8686 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, 8775 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8687 HDA_AMP_MUTE, 8776 HDA_AMP_MUTE,
8688 valp[1] ? 0 : HDA_AMP_MUTE); 8777 valp ? 0 : HDA_AMP_MUTE);
8778
8689 if (change) 8779 if (change)
8690 alc262_fujitsu_automute(codec, 0); 8780 alc262_fujitsu_automute(codec, 0);
8691 return change; 8781 return change;
@@ -8703,6 +8793,46 @@ static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
8703 }, 8793 },
8704 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 8794 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8705 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 8795 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8796 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),
8797 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),
8798 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8799 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8800 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8801 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8802 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8803 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8804 { } /* end */
8805};
8806
8807/* bind hp and internal speaker mute (with plug check) */
8808static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
8809 struct snd_ctl_elem_value *ucontrol)
8810{
8811 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8812 long *valp = ucontrol->value.integer.value;
8813 int change;
8814
8815 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8816 HDA_AMP_MUTE,
8817 valp ? 0 : HDA_AMP_MUTE);
8818
8819 if (change)
8820 alc262_lenovo_3000_automute(codec, 0);
8821 return change;
8822}
8823
8824static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
8825 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
8826 {
8827 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8828 .name = "Master Playback Switch",
8829 .info = snd_hda_mixer_amp_switch_info,
8830 .get = snd_hda_mixer_amp_switch_get,
8831 .put = alc262_lenovo_3000_master_sw_put,
8832 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
8833 },
8834 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8835 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8706 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 8836 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8707 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 8837 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8708 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 8838 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
@@ -8730,59 +8860,72 @@ static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
8730 8860
8731/* Samsung Q1 Ultra Vista model setup */ 8861/* Samsung Q1 Ultra Vista model setup */
8732static struct snd_kcontrol_new alc262_ultra_mixer[] = { 8862static struct snd_kcontrol_new alc262_ultra_mixer[] = {
8733 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 8863 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8734 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), 8864 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
8735 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8736 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), 8865 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8737 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), 8866 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8738 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), 8867 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8868 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
8739 { } /* end */ 8869 { } /* end */
8740}; 8870};
8741 8871
8742static struct hda_verb alc262_ultra_verbs[] = { 8872static struct hda_verb alc262_ultra_verbs[] = {
8743 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 8873 /* output mixer */
8874 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8875 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8876 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8877 /* speaker */
8878 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8879 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8880 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8881 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8882 /* HP */
8744 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 8883 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8745 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, 8884 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8746 /* Mic is on Node 0x19 */ 8885 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8747 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, 8886 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8748 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, 8887 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8749 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, 8888 /* internal mic */
8750 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, 8889 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8751 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, 8890 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8752 {0x24, AC_VERB_SET_CONNECT_SEL, 0x01}, 8891 /* ADC, choose mic */
8753 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, 8892 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8893 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8894 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8895 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8896 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8897 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8898 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
8899 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
8900 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
8901 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
8754 {} 8902 {}
8755}; 8903};
8756 8904
8757static struct hda_input_mux alc262_ultra_capture_source = {
8758 .num_items = 1,
8759 .items = {
8760 { "Mic", 0x1 },
8761 },
8762};
8763
8764/* mute/unmute internal speaker according to the hp jack and mute state */ 8905/* mute/unmute internal speaker according to the hp jack and mute state */
8765static void alc262_ultra_automute(struct hda_codec *codec) 8906static void alc262_ultra_automute(struct hda_codec *codec)
8766{ 8907{
8767 struct alc_spec *spec = codec->spec; 8908 struct alc_spec *spec = codec->spec;
8768 unsigned int mute; 8909 unsigned int mute;
8769 unsigned int present;
8770 8910
8771 /* need to execute and sync at first */ 8911 mute = 0;
8772 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); 8912 /* auto-mute only when HP is used as HP */
8773 present = snd_hda_codec_read(codec, 0x15, 0, 8913 if (!spec->cur_mux[0]) {
8774 AC_VERB_GET_PIN_SENSE, 0); 8914 unsigned int present;
8775 spec->jack_present = (present & 0x80000000) != 0; 8915 /* need to execute and sync at first */
8776 if (spec->jack_present) { 8916 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8777 /* mute internal speaker */ 8917 present = snd_hda_codec_read(codec, 0x15, 0,
8778 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 8918 AC_VERB_GET_PIN_SENSE, 0);
8779 HDA_AMP_MUTE, HDA_AMP_MUTE); 8919 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
8780 } else { 8920 if (spec->jack_present)
8781 /* unmute internal speaker if necessary */ 8921 mute = HDA_AMP_MUTE;
8782 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8783 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8784 HDA_AMP_MUTE, mute);
8785 } 8922 }
8923 /* mute/unmute internal speaker */
8924 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8925 HDA_AMP_MUTE, mute);
8926 /* mute/unmute HP */
8927 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8928 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
8786} 8929}
8787 8930
8788/* unsolicited event for HP jack sensing */ 8931/* unsolicited event for HP jack sensing */
@@ -8794,6 +8937,45 @@ static void alc262_ultra_unsol_event(struct hda_codec *codec,
8794 alc262_ultra_automute(codec); 8937 alc262_ultra_automute(codec);
8795} 8938}
8796 8939
8940static struct hda_input_mux alc262_ultra_capture_source = {
8941 .num_items = 2,
8942 .items = {
8943 { "Mic", 0x1 },
8944 { "Headphone", 0x7 },
8945 },
8946};
8947
8948static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
8949 struct snd_ctl_elem_value *ucontrol)
8950{
8951 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8952 struct alc_spec *spec = codec->spec;
8953 int ret;
8954
8955 ret = alc882_mux_enum_put(kcontrol, ucontrol);
8956 if (!ret)
8957 return 0;
8958 /* reprogram the HP pin as mic or HP according to the input source */
8959 snd_hda_codec_write_cache(codec, 0x15, 0,
8960 AC_VERB_SET_PIN_WIDGET_CONTROL,
8961 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
8962 alc262_ultra_automute(codec); /* mute/unmute HP */
8963 return ret;
8964}
8965
8966static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
8967 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
8968 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
8969 {
8970 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8971 .name = "Capture Source",
8972 .info = alc882_mux_enum_info,
8973 .get = alc882_mux_enum_get,
8974 .put = alc262_ultra_mux_enum_put,
8975 },
8976 { } /* end */
8977};
8978
8797/* add playback controls from the parsed DAC table */ 8979/* add playback controls from the parsed DAC table */
8798static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, 8980static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
8799 const struct auto_pin_cfg *cfg) 8981 const struct auto_pin_cfg *cfg)
@@ -9185,9 +9367,12 @@ static int alc262_parse_auto_config(struct hda_codec *codec)
9185/* init callback for auto-configuration model -- overriding the default init */ 9367/* init callback for auto-configuration model -- overriding the default init */
9186static void alc262_auto_init(struct hda_codec *codec) 9368static void alc262_auto_init(struct hda_codec *codec)
9187{ 9369{
9370 struct alc_spec *spec = codec->spec;
9188 alc262_auto_init_multi_out(codec); 9371 alc262_auto_init_multi_out(codec);
9189 alc262_auto_init_hp_out(codec); 9372 alc262_auto_init_hp_out(codec);
9190 alc262_auto_init_analog_input(codec); 9373 alc262_auto_init_analog_input(codec);
9374 if (spec->unsol_event)
9375 alc_sku_automute(codec);
9191} 9376}
9192 9377
9193/* 9378/*
@@ -9206,6 +9391,7 @@ static const char *alc262_models[ALC262_MODEL_LAST] = {
9206 [ALC262_BENQ_T31] = "benq-t31", 9391 [ALC262_BENQ_T31] = "benq-t31",
9207 [ALC262_SONY_ASSAMD] = "sony-assamd", 9392 [ALC262_SONY_ASSAMD] = "sony-assamd",
9208 [ALC262_ULTRA] = "ultra", 9393 [ALC262_ULTRA] = "ultra",
9394 [ALC262_LENOVO_3000] = "lenovo-3000",
9209 [ALC262_AUTO] = "auto", 9395 [ALC262_AUTO] = "auto",
9210}; 9396};
9211 9397
@@ -9241,6 +9427,8 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = {
9241 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), 9427 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
9242 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), 9428 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
9243 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), 9429 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
9430 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
9431 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
9244 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), 9432 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
9245 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), 9433 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
9246 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), 9434 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
@@ -9390,18 +9578,32 @@ static struct alc_config_preset alc262_presets[] = {
9390 .init_hook = alc262_hippo_automute, 9578 .init_hook = alc262_hippo_automute,
9391 }, 9579 },
9392 [ALC262_ULTRA] = { 9580 [ALC262_ULTRA] = {
9393 .mixers = { alc262_ultra_mixer }, 9581 .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer },
9394 .init_verbs = { alc262_init_verbs, alc262_ultra_verbs }, 9582 .init_verbs = { alc262_ultra_verbs },
9395 .num_dacs = ARRAY_SIZE(alc262_dac_nids), 9583 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9396 .dac_nids = alc262_dac_nids, 9584 .dac_nids = alc262_dac_nids,
9397 .hp_nid = 0x03,
9398 .dig_out_nid = ALC262_DIGOUT_NID,
9399 .num_channel_mode = ARRAY_SIZE(alc262_modes), 9585 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9400 .channel_mode = alc262_modes, 9586 .channel_mode = alc262_modes,
9401 .input_mux = &alc262_ultra_capture_source, 9587 .input_mux = &alc262_ultra_capture_source,
9588 .adc_nids = alc262_adc_nids, /* ADC0 */
9589 .capsrc_nids = alc262_capsrc_nids,
9590 .num_adc_nids = 1, /* single ADC */
9402 .unsol_event = alc262_ultra_unsol_event, 9591 .unsol_event = alc262_ultra_unsol_event,
9403 .init_hook = alc262_ultra_automute, 9592 .init_hook = alc262_ultra_automute,
9404 }, 9593 },
9594 [ALC262_LENOVO_3000] = {
9595 .mixers = { alc262_lenovo_3000_mixer },
9596 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9597 alc262_lenovo_3000_unsol_verbs },
9598 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9599 .dac_nids = alc262_dac_nids,
9600 .hp_nid = 0x03,
9601 .dig_out_nid = ALC262_DIGOUT_NID,
9602 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9603 .channel_mode = alc262_modes,
9604 .input_mux = &alc262_fujitsu_capture_source,
9605 .unsol_event = alc262_lenovo_3000_unsol_event,
9606 },
9405}; 9607};
9406 9608
9407static int patch_alc262(struct hda_codec *codec) 9609static int patch_alc262(struct hda_codec *codec)
@@ -9472,12 +9674,14 @@ static int patch_alc262(struct hda_codec *codec)
9472 if (wcap != AC_WID_AUD_IN) { 9674 if (wcap != AC_WID_AUD_IN) {
9473 spec->adc_nids = alc262_adc_nids_alt; 9675 spec->adc_nids = alc262_adc_nids_alt;
9474 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); 9676 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
9677 spec->capsrc_nids = alc262_capsrc_nids_alt;
9475 spec->mixers[spec->num_mixers] = 9678 spec->mixers[spec->num_mixers] =
9476 alc262_capture_alt_mixer; 9679 alc262_capture_alt_mixer;
9477 spec->num_mixers++; 9680 spec->num_mixers++;
9478 } else { 9681 } else {
9479 spec->adc_nids = alc262_adc_nids; 9682 spec->adc_nids = alc262_adc_nids;
9480 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); 9683 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
9684 spec->capsrc_nids = alc262_capsrc_nids;
9481 spec->mixers[spec->num_mixers] = alc262_capture_mixer; 9685 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
9482 spec->num_mixers++; 9686 spec->num_mixers++;
9483 } 9687 }
@@ -9517,6 +9721,8 @@ static hda_nid_t alc268_adc_nids_alt[1] = {
9517 0x08 9721 0x08
9518}; 9722};
9519 9723
9724static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
9725
9520static struct snd_kcontrol_new alc268_base_mixer[] = { 9726static struct snd_kcontrol_new alc268_base_mixer[] = {
9521 /* output mixer control */ 9727 /* output mixer control */
9522 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), 9728 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
@@ -9529,6 +9735,22 @@ static struct snd_kcontrol_new alc268_base_mixer[] = {
9529 { } 9735 { }
9530}; 9736};
9531 9737
9738/* bind Beep switches of both NID 0x0f and 0x10 */
9739static struct hda_bind_ctls alc268_bind_beep_sw = {
9740 .ops = &snd_hda_bind_sw,
9741 .values = {
9742 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
9743 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
9744 0
9745 },
9746};
9747
9748static struct snd_kcontrol_new alc268_beep_mixer[] = {
9749 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
9750 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
9751 { }
9752};
9753
9532static struct hda_verb alc268_eapd_verbs[] = { 9754static struct hda_verb alc268_eapd_verbs[] = {
9533 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, 9755 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9534 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, 9756 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
@@ -9613,8 +9835,12 @@ static struct snd_kcontrol_new alc268_acer_mixer[] = {
9613}; 9835};
9614 9836
9615static struct hda_verb alc268_acer_verbs[] = { 9837static struct hda_verb alc268_acer_verbs[] = {
9838 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
9839 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9616 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 9840 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9617 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 9841 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9842 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9843 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9618 9844
9619 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 9845 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9620 { } 9846 { }
@@ -9685,6 +9911,64 @@ static void alc268_dell_unsol_event(struct hda_codec *codec,
9685 9911
9686#define alc268_dell_init_hook alc268_dell_automute 9912#define alc268_dell_init_hook alc268_dell_automute
9687 9913
9914static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
9915 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
9916 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9917 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
9918 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9919 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9920 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
9921 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
9922 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9923 { }
9924};
9925
9926static struct hda_verb alc267_quanta_il1_verbs[] = {
9927 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9928 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9929 { }
9930};
9931
9932static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
9933{
9934 unsigned int present;
9935
9936 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
9937 & AC_PINSENSE_PRESENCE;
9938 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
9939 present ? 0 : PIN_OUT);
9940}
9941
9942static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
9943{
9944 unsigned int present;
9945
9946 present = snd_hda_codec_read(codec, 0x18, 0,
9947 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9948 snd_hda_codec_write(codec, 0x23, 0,
9949 AC_VERB_SET_CONNECT_SEL,
9950 present ? 0x00 : 0x01);
9951}
9952
9953static void alc267_quanta_il1_automute(struct hda_codec *codec)
9954{
9955 alc267_quanta_il1_hp_automute(codec);
9956 alc267_quanta_il1_mic_automute(codec);
9957}
9958
9959static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
9960 unsigned int res)
9961{
9962 switch (res >> 26) {
9963 case ALC880_HP_EVENT:
9964 alc267_quanta_il1_hp_automute(codec);
9965 break;
9966 case ALC880_MIC_EVENT:
9967 alc267_quanta_il1_mic_automute(codec);
9968 break;
9969 }
9970}
9971
9688/* 9972/*
9689 * generic initialization of ADC, input mixers and output mixers 9973 * generic initialization of ADC, input mixers and output mixers
9690 */ 9974 */
@@ -9725,7 +10009,11 @@ static struct hda_verb alc268_base_init_verbs[] = {
9725 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 10009 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9726 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 10010 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9727 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 10011 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9728 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 10012
10013 /* set PCBEEP vol = 0, mute connections */
10014 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10015 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10016 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9729 10017
9730 /* Unmute Selector 23h,24h and set the default input to mic-in */ 10018 /* Unmute Selector 23h,24h and set the default input to mic-in */
9731 10019
@@ -9764,29 +10052,17 @@ static struct hda_verb alc268_volume_init_verbs[] = {
9764 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 10052 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9765 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 10053 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9766 10054
9767 /* set PCBEEP vol = 0 */ 10055 /* set PCBEEP vol = 0, mute connections */
9768 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))}, 10056 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10057 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10058 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9769 10059
9770 { } 10060 { }
9771}; 10061};
9772 10062
9773#define alc268_mux_enum_info alc_mux_enum_info 10063#define alc268_mux_enum_info alc_mux_enum_info
9774#define alc268_mux_enum_get alc_mux_enum_get 10064#define alc268_mux_enum_get alc_mux_enum_get
9775 10065#define alc268_mux_enum_put alc_mux_enum_put
9776static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol,
9777 struct snd_ctl_elem_value *ucontrol)
9778{
9779 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9780 struct alc_spec *spec = codec->spec;
9781
9782 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
9783 static hda_nid_t capture_mixers[3] = { 0x23, 0x24 };
9784 hda_nid_t nid = capture_mixers[adc_idx];
9785
9786 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
9787 nid,
9788 &spec->cur_mux[adc_idx]);
9789}
9790 10066
9791static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { 10067static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
9792 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), 10068 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
@@ -9836,13 +10112,17 @@ static struct hda_input_mux alc268_capture_source = {
9836 }, 10112 },
9837}; 10113};
9838 10114
10115static struct hda_input_mux alc268_acer_capture_source = {
10116 .num_items = 3,
10117 .items = {
10118 { "Mic", 0x0 },
10119 { "Internal Mic", 0x6 },
10120 { "Line", 0x2 },
10121 },
10122};
10123
9839#ifdef CONFIG_SND_DEBUG 10124#ifdef CONFIG_SND_DEBUG
9840static struct snd_kcontrol_new alc268_test_mixer[] = { 10125static struct snd_kcontrol_new alc268_test_mixer[] = {
9841 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
9842 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9843 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
9844 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9845
9846 /* Volume widgets */ 10126 /* Volume widgets */
9847 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), 10127 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9848 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), 10128 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
@@ -9981,6 +10261,10 @@ static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
9981 case 0x1c: 10261 case 0x1c:
9982 idx1 = 3; /* CD */ 10262 idx1 = 3; /* CD */
9983 break; 10263 break;
10264 case 0x12:
10265 case 0x13:
10266 idx1 = 6; /* digital mics */
10267 break;
9984 default: 10268 default:
9985 continue; 10269 continue;
9986 } 10270 }
@@ -10073,6 +10357,9 @@ static int alc268_parse_auto_config(struct hda_codec *codec)
10073 if (spec->kctl_alloc) 10357 if (spec->kctl_alloc)
10074 spec->mixers[spec->num_mixers++] = spec->kctl_alloc; 10358 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10075 10359
10360 if (spec->autocfg.speaker_pins[0] != 0x1d)
10361 spec->mixers[spec->num_mixers++] = alc268_beep_mixer;
10362
10076 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; 10363 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
10077 spec->num_mux_defs = 1; 10364 spec->num_mux_defs = 1;
10078 spec->input_mux = &spec->private_imux; 10365 spec->input_mux = &spec->private_imux;
@@ -10091,20 +10378,25 @@ static int alc268_parse_auto_config(struct hda_codec *codec)
10091/* init callback for auto-configuration model -- overriding the default init */ 10378/* init callback for auto-configuration model -- overriding the default init */
10092static void alc268_auto_init(struct hda_codec *codec) 10379static void alc268_auto_init(struct hda_codec *codec)
10093{ 10380{
10381 struct alc_spec *spec = codec->spec;
10094 alc268_auto_init_multi_out(codec); 10382 alc268_auto_init_multi_out(codec);
10095 alc268_auto_init_hp_out(codec); 10383 alc268_auto_init_hp_out(codec);
10096 alc268_auto_init_mono_speaker_out(codec); 10384 alc268_auto_init_mono_speaker_out(codec);
10097 alc268_auto_init_analog_input(codec); 10385 alc268_auto_init_analog_input(codec);
10386 if (spec->unsol_event)
10387 alc_sku_automute(codec);
10098} 10388}
10099 10389
10100/* 10390/*
10101 * configuration and preset 10391 * configuration and preset
10102 */ 10392 */
10103static const char *alc268_models[ALC268_MODEL_LAST] = { 10393static const char *alc268_models[ALC268_MODEL_LAST] = {
10394 [ALC267_QUANTA_IL1] = "quanta-il1",
10104 [ALC268_3ST] = "3stack", 10395 [ALC268_3ST] = "3stack",
10105 [ALC268_TOSHIBA] = "toshiba", 10396 [ALC268_TOSHIBA] = "toshiba",
10106 [ALC268_ACER] = "acer", 10397 [ALC268_ACER] = "acer",
10107 [ALC268_DELL] = "dell", 10398 [ALC268_DELL] = "dell",
10399 [ALC268_ZEPTO] = "zepto",
10108#ifdef CONFIG_SND_DEBUG 10400#ifdef CONFIG_SND_DEBUG
10109 [ALC268_TEST] = "test", 10401 [ALC268_TEST] = "test",
10110#endif 10402#endif
@@ -10112,6 +10404,7 @@ static const char *alc268_models[ALC268_MODEL_LAST] = {
10112}; 10404};
10113 10405
10114static struct snd_pci_quirk alc268_cfg_tbl[] = { 10406static struct snd_pci_quirk alc268_cfg_tbl[] = {
10407 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
10115 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), 10408 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
10116 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), 10409 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
10117 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), 10410 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
@@ -10122,17 +10415,36 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = {
10122 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), 10415 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
10123 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), 10416 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
10124 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), 10417 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
10418 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
10419 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
10125 {} 10420 {}
10126}; 10421};
10127 10422
10128static struct alc_config_preset alc268_presets[] = { 10423static struct alc_config_preset alc268_presets[] = {
10424 [ALC267_QUANTA_IL1] = {
10425 .mixers = { alc267_quanta_il1_mixer },
10426 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10427 alc267_quanta_il1_verbs },
10428 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10429 .dac_nids = alc268_dac_nids,
10430 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10431 .adc_nids = alc268_adc_nids_alt,
10432 .hp_nid = 0x03,
10433 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10434 .channel_mode = alc268_modes,
10435 .input_mux = &alc268_capture_source,
10436 .unsol_event = alc267_quanta_il1_unsol_event,
10437 .init_hook = alc267_quanta_il1_automute,
10438 },
10129 [ALC268_3ST] = { 10439 [ALC268_3ST] = {
10130 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, 10440 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10441 alc268_beep_mixer },
10131 .init_verbs = { alc268_base_init_verbs }, 10442 .init_verbs = { alc268_base_init_verbs },
10132 .num_dacs = ARRAY_SIZE(alc268_dac_nids), 10443 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10133 .dac_nids = alc268_dac_nids, 10444 .dac_nids = alc268_dac_nids,
10134 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), 10445 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10135 .adc_nids = alc268_adc_nids_alt, 10446 .adc_nids = alc268_adc_nids_alt,
10447 .capsrc_nids = alc268_capsrc_nids,
10136 .hp_nid = 0x03, 10448 .hp_nid = 0x03,
10137 .dig_out_nid = ALC268_DIGOUT_NID, 10449 .dig_out_nid = ALC268_DIGOUT_NID,
10138 .num_channel_mode = ARRAY_SIZE(alc268_modes), 10450 .num_channel_mode = ARRAY_SIZE(alc268_modes),
@@ -10140,13 +10452,15 @@ static struct alc_config_preset alc268_presets[] = {
10140 .input_mux = &alc268_capture_source, 10452 .input_mux = &alc268_capture_source,
10141 }, 10453 },
10142 [ALC268_TOSHIBA] = { 10454 [ALC268_TOSHIBA] = {
10143 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, 10455 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10456 alc268_beep_mixer },
10144 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 10457 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10145 alc268_toshiba_verbs }, 10458 alc268_toshiba_verbs },
10146 .num_dacs = ARRAY_SIZE(alc268_dac_nids), 10459 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10147 .dac_nids = alc268_dac_nids, 10460 .dac_nids = alc268_dac_nids,
10148 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), 10461 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10149 .adc_nids = alc268_adc_nids_alt, 10462 .adc_nids = alc268_adc_nids_alt,
10463 .capsrc_nids = alc268_capsrc_nids,
10150 .hp_nid = 0x03, 10464 .hp_nid = 0x03,
10151 .num_channel_mode = ARRAY_SIZE(alc268_modes), 10465 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10152 .channel_mode = alc268_modes, 10466 .channel_mode = alc268_modes,
@@ -10155,22 +10469,24 @@ static struct alc_config_preset alc268_presets[] = {
10155 .init_hook = alc268_toshiba_automute, 10469 .init_hook = alc268_toshiba_automute,
10156 }, 10470 },
10157 [ALC268_ACER] = { 10471 [ALC268_ACER] = {
10158 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer }, 10472 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
10473 alc268_beep_mixer },
10159 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 10474 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10160 alc268_acer_verbs }, 10475 alc268_acer_verbs },
10161 .num_dacs = ARRAY_SIZE(alc268_dac_nids), 10476 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10162 .dac_nids = alc268_dac_nids, 10477 .dac_nids = alc268_dac_nids,
10163 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), 10478 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10164 .adc_nids = alc268_adc_nids_alt, 10479 .adc_nids = alc268_adc_nids_alt,
10480 .capsrc_nids = alc268_capsrc_nids,
10165 .hp_nid = 0x02, 10481 .hp_nid = 0x02,
10166 .num_channel_mode = ARRAY_SIZE(alc268_modes), 10482 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10167 .channel_mode = alc268_modes, 10483 .channel_mode = alc268_modes,
10168 .input_mux = &alc268_capture_source, 10484 .input_mux = &alc268_acer_capture_source,
10169 .unsol_event = alc268_acer_unsol_event, 10485 .unsol_event = alc268_acer_unsol_event,
10170 .init_hook = alc268_acer_init_hook, 10486 .init_hook = alc268_acer_init_hook,
10171 }, 10487 },
10172 [ALC268_DELL] = { 10488 [ALC268_DELL] = {
10173 .mixers = { alc268_dell_mixer }, 10489 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
10174 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 10490 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10175 alc268_dell_verbs }, 10491 alc268_dell_verbs },
10176 .num_dacs = ARRAY_SIZE(alc268_dac_nids), 10492 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
@@ -10182,6 +10498,24 @@ static struct alc_config_preset alc268_presets[] = {
10182 .init_hook = alc268_dell_init_hook, 10498 .init_hook = alc268_dell_init_hook,
10183 .input_mux = &alc268_capture_source, 10499 .input_mux = &alc268_capture_source,
10184 }, 10500 },
10501 [ALC268_ZEPTO] = {
10502 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10503 alc268_beep_mixer },
10504 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10505 alc268_toshiba_verbs },
10506 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10507 .dac_nids = alc268_dac_nids,
10508 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10509 .adc_nids = alc268_adc_nids_alt,
10510 .capsrc_nids = alc268_capsrc_nids,
10511 .hp_nid = 0x03,
10512 .dig_out_nid = ALC268_DIGOUT_NID,
10513 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10514 .channel_mode = alc268_modes,
10515 .input_mux = &alc268_capture_source,
10516 .unsol_event = alc268_toshiba_unsol_event,
10517 .init_hook = alc268_toshiba_automute
10518 },
10185#ifdef CONFIG_SND_DEBUG 10519#ifdef CONFIG_SND_DEBUG
10186 [ALC268_TEST] = { 10520 [ALC268_TEST] = {
10187 .mixers = { alc268_test_mixer, alc268_capture_mixer }, 10521 .mixers = { alc268_test_mixer, alc268_capture_mixer },
@@ -10191,6 +10525,7 @@ static struct alc_config_preset alc268_presets[] = {
10191 .dac_nids = alc268_dac_nids, 10525 .dac_nids = alc268_dac_nids,
10192 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), 10526 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10193 .adc_nids = alc268_adc_nids_alt, 10527 .adc_nids = alc268_adc_nids_alt,
10528 .capsrc_nids = alc268_capsrc_nids,
10194 .hp_nid = 0x03, 10529 .hp_nid = 0x03,
10195 .dig_out_nid = ALC268_DIGOUT_NID, 10530 .dig_out_nid = ALC268_DIGOUT_NID,
10196 .num_channel_mode = ARRAY_SIZE(alc268_modes), 10531 .num_channel_mode = ARRAY_SIZE(alc268_modes),
@@ -10247,13 +10582,22 @@ static int patch_alc268(struct hda_codec *codec)
10247 spec->stream_name_digital = "ALC268 Digital"; 10582 spec->stream_name_digital = "ALC268 Digital";
10248 spec->stream_digital_playback = &alc268_pcm_digital_playback; 10583 spec->stream_digital_playback = &alc268_pcm_digital_playback;
10249 10584
10585 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
10586 /* override the amp caps for beep generator */
10587 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
10588 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
10589 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
10590 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10591 (0 << AC_AMPCAP_MUTE_SHIFT));
10592
10250 if (!spec->adc_nids && spec->input_mux) { 10593 if (!spec->adc_nids && spec->input_mux) {
10251 /* check whether NID 0x07 is valid */ 10594 /* check whether NID 0x07 is valid */
10252 unsigned int wcap = get_wcaps(codec, 0x07); 10595 unsigned int wcap = get_wcaps(codec, 0x07);
10596 int i;
10253 10597
10254 /* get type */ 10598 /* get type */
10255 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; 10599 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10256 if (wcap != AC_WID_AUD_IN) { 10600 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
10257 spec->adc_nids = alc268_adc_nids_alt; 10601 spec->adc_nids = alc268_adc_nids_alt;
10258 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); 10602 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
10259 spec->mixers[spec->num_mixers] = 10603 spec->mixers[spec->num_mixers] =
@@ -10266,6 +10610,12 @@ static int patch_alc268(struct hda_codec *codec)
10266 alc268_capture_mixer; 10610 alc268_capture_mixer;
10267 spec->num_mixers++; 10611 spec->num_mixers++;
10268 } 10612 }
10613 spec->capsrc_nids = alc268_capsrc_nids;
10614 /* set default input source */
10615 for (i = 0; i < spec->num_adc_nids; i++)
10616 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
10617 0, AC_VERB_SET_CONNECT_SEL,
10618 spec->input_mux->items[0].index);
10269 } 10619 }
10270 10620
10271 spec->vmaster_nid = 0x02; 10621 spec->vmaster_nid = 0x02;
@@ -10539,9 +10889,12 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
10539/* init callback for auto-configuration model -- overriding the default init */ 10889/* init callback for auto-configuration model -- overriding the default init */
10540static void alc269_auto_init(struct hda_codec *codec) 10890static void alc269_auto_init(struct hda_codec *codec)
10541{ 10891{
10892 struct alc_spec *spec = codec->spec;
10542 alc269_auto_init_multi_out(codec); 10893 alc269_auto_init_multi_out(codec);
10543 alc269_auto_init_hp_out(codec); 10894 alc269_auto_init_hp_out(codec);
10544 alc269_auto_init_analog_input(codec); 10895 alc269_auto_init_analog_input(codec);
10896 if (spec->unsol_event)
10897 alc_sku_automute(codec);
10545} 10898}
10546 10899
10547/* 10900/*
@@ -11463,13 +11816,7 @@ static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
11463 hda_nid_t nid, 11816 hda_nid_t nid,
11464 int pin_type, int dac_idx) 11817 int pin_type, int dac_idx)
11465{ 11818{
11466 /* set as output */ 11819 alc_set_pin_output(codec, nid, pin_type);
11467
11468 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11469 pin_type);
11470 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11471 AMP_OUT_UNMUTE);
11472
11473} 11820}
11474 11821
11475static void alc861_auto_init_multi_out(struct hda_codec *codec) 11822static void alc861_auto_init_multi_out(struct hda_codec *codec)
@@ -11496,6 +11843,9 @@ static void alc861_auto_init_hp_out(struct hda_codec *codec)
11496 if (pin) /* connect to front */ 11843 if (pin) /* connect to front */
11497 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, 11844 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
11498 spec->multiout.dac_nids[0]); 11845 spec->multiout.dac_nids[0]);
11846 pin = spec->autocfg.speaker_pins[0];
11847 if (pin)
11848 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
11499} 11849}
11500 11850
11501static void alc861_auto_init_analog_input(struct hda_codec *codec) 11851static void alc861_auto_init_analog_input(struct hda_codec *codec)
@@ -11568,9 +11918,12 @@ static int alc861_parse_auto_config(struct hda_codec *codec)
11568/* additional initialization for auto-configuration model */ 11918/* additional initialization for auto-configuration model */
11569static void alc861_auto_init(struct hda_codec *codec) 11919static void alc861_auto_init(struct hda_codec *codec)
11570{ 11920{
11921 struct alc_spec *spec = codec->spec;
11571 alc861_auto_init_multi_out(codec); 11922 alc861_auto_init_multi_out(codec);
11572 alc861_auto_init_hp_out(codec); 11923 alc861_auto_init_hp_out(codec);
11573 alc861_auto_init_analog_input(codec); 11924 alc861_auto_init_analog_input(codec);
11925 if (spec->unsol_event)
11926 alc_sku_automute(codec);
11574} 11927}
11575 11928
11576#ifdef CONFIG_SND_HDA_POWER_SAVE 11929#ifdef CONFIG_SND_HDA_POWER_SAVE
@@ -11822,6 +12175,8 @@ static hda_nid_t alc861vd_adc_nids[1] = {
11822 0x09, 12175 0x09,
11823}; 12176};
11824 12177
12178static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
12179
11825/* input MUX */ 12180/* input MUX */
11826/* FIXME: should be a matrix-type input source selection */ 12181/* FIXME: should be a matrix-type input source selection */
11827static struct hda_input_mux alc861vd_capture_source = { 12182static struct hda_input_mux alc861vd_capture_source = {
@@ -11835,11 +12190,10 @@ static struct hda_input_mux alc861vd_capture_source = {
11835}; 12190};
11836 12191
11837static struct hda_input_mux alc861vd_dallas_capture_source = { 12192static struct hda_input_mux alc861vd_dallas_capture_source = {
11838 .num_items = 3, 12193 .num_items = 2,
11839 .items = { 12194 .items = {
11840 { "Front Mic", 0x0 }, 12195 { "Ext Mic", 0x0 },
11841 { "ATAPI Mic", 0x1 }, 12196 { "Int Mic", 0x1 },
11842 { "Line In", 0x5 },
11843 }, 12197 },
11844}; 12198};
11845 12199
@@ -11853,33 +12207,8 @@ static struct hda_input_mux alc861vd_hp_capture_source = {
11853 12207
11854#define alc861vd_mux_enum_info alc_mux_enum_info 12208#define alc861vd_mux_enum_info alc_mux_enum_info
11855#define alc861vd_mux_enum_get alc_mux_enum_get 12209#define alc861vd_mux_enum_get alc_mux_enum_get
11856 12210/* ALC861VD has the ALC882-type input selection (but has only one ADC) */
11857static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol, 12211#define alc861vd_mux_enum_put alc882_mux_enum_put
11858 struct snd_ctl_elem_value *ucontrol)
11859{
11860 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11861 struct alc_spec *spec = codec->spec;
11862 const struct hda_input_mux *imux = spec->input_mux;
11863 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
11864 static hda_nid_t capture_mixers[1] = { 0x22 };
11865 hda_nid_t nid = capture_mixers[adc_idx];
11866 unsigned int *cur_val = &spec->cur_mux[adc_idx];
11867 unsigned int i, idx;
11868
11869 idx = ucontrol->value.enumerated.item[0];
11870 if (idx >= imux->num_items)
11871 idx = imux->num_items - 1;
11872 if (*cur_val == idx)
11873 return 0;
11874 for (i = 0; i < imux->num_items; i++) {
11875 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
11876 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
11877 imux->items[i].index,
11878 HDA_AMP_MUTE, v);
11879 }
11880 *cur_val = idx;
11881 return 1;
11882}
11883 12212
11884/* 12213/*
11885 * 2ch mode 12214 * 2ch mode
@@ -12034,20 +12363,22 @@ static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
12034 { } /* end */ 12363 { } /* end */
12035}; 12364};
12036 12365
12037/* Pin assignment: Front=0x14, HP = 0x15, 12366/* Pin assignment: Speaker=0x14, HP = 0x15,
12038 * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d 12367 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
12039 */ 12368 */
12040static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { 12369static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
12041 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), 12370 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12042 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 12371 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
12043 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), 12372 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12044 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), 12373 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
12045 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 12374 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12046 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 12375 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12047 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 12376 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12048 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 12377 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12049 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT), 12378 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12050 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT), 12379 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12380 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
12381 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
12051 { } /* end */ 12382 { } /* end */
12052}; 12383};
12053 12384
@@ -12348,6 +12679,7 @@ static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
12348 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ 12679 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
12349 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), 12680 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
12350 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), 12681 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
12682 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
12351 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), 12683 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
12352 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), 12684 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
12353 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), 12685 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
@@ -12362,8 +12694,6 @@ static struct alc_config_preset alc861vd_presets[] = {
12362 alc861vd_3stack_init_verbs }, 12694 alc861vd_3stack_init_verbs },
12363 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), 12695 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12364 .dac_nids = alc660vd_dac_nids, 12696 .dac_nids = alc660vd_dac_nids,
12365 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12366 .adc_nids = alc861vd_adc_nids,
12367 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), 12697 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12368 .channel_mode = alc861vd_3stack_2ch_modes, 12698 .channel_mode = alc861vd_3stack_2ch_modes,
12369 .input_mux = &alc861vd_capture_source, 12699 .input_mux = &alc861vd_capture_source,
@@ -12375,8 +12705,6 @@ static struct alc_config_preset alc861vd_presets[] = {
12375 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), 12705 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12376 .dac_nids = alc660vd_dac_nids, 12706 .dac_nids = alc660vd_dac_nids,
12377 .dig_out_nid = ALC861VD_DIGOUT_NID, 12707 .dig_out_nid = ALC861VD_DIGOUT_NID,
12378 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12379 .adc_nids = alc861vd_adc_nids,
12380 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), 12708 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12381 .channel_mode = alc861vd_3stack_2ch_modes, 12709 .channel_mode = alc861vd_3stack_2ch_modes,
12382 .input_mux = &alc861vd_capture_source, 12710 .input_mux = &alc861vd_capture_source,
@@ -12421,8 +12749,6 @@ static struct alc_config_preset alc861vd_presets[] = {
12421 alc861vd_lenovo_unsol_verbs }, 12749 alc861vd_lenovo_unsol_verbs },
12422 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), 12750 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12423 .dac_nids = alc660vd_dac_nids, 12751 .dac_nids = alc660vd_dac_nids,
12424 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12425 .adc_nids = alc861vd_adc_nids,
12426 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), 12752 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12427 .channel_mode = alc861vd_3stack_2ch_modes, 12753 .channel_mode = alc861vd_3stack_2ch_modes,
12428 .input_mux = &alc861vd_capture_source, 12754 .input_mux = &alc861vd_capture_source,
@@ -12434,8 +12760,6 @@ static struct alc_config_preset alc861vd_presets[] = {
12434 .init_verbs = { alc861vd_dallas_verbs }, 12760 .init_verbs = { alc861vd_dallas_verbs },
12435 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), 12761 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12436 .dac_nids = alc861vd_dac_nids, 12762 .dac_nids = alc861vd_dac_nids,
12437 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12438 .adc_nids = alc861vd_adc_nids,
12439 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), 12763 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12440 .channel_mode = alc861vd_3stack_2ch_modes, 12764 .channel_mode = alc861vd_3stack_2ch_modes,
12441 .input_mux = &alc861vd_dallas_capture_source, 12765 .input_mux = &alc861vd_dallas_capture_source,
@@ -12447,9 +12771,7 @@ static struct alc_config_preset alc861vd_presets[] = {
12447 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, 12771 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
12448 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), 12772 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12449 .dac_nids = alc861vd_dac_nids, 12773 .dac_nids = alc861vd_dac_nids,
12450 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12451 .dig_out_nid = ALC861VD_DIGOUT_NID, 12774 .dig_out_nid = ALC861VD_DIGOUT_NID,
12452 .adc_nids = alc861vd_adc_nids,
12453 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), 12775 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12454 .channel_mode = alc861vd_3stack_2ch_modes, 12776 .channel_mode = alc861vd_3stack_2ch_modes,
12455 .input_mux = &alc861vd_hp_capture_source, 12777 .input_mux = &alc861vd_hp_capture_source,
@@ -12464,11 +12786,7 @@ static struct alc_config_preset alc861vd_presets[] = {
12464static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, 12786static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
12465 hda_nid_t nid, int pin_type, int dac_idx) 12787 hda_nid_t nid, int pin_type, int dac_idx)
12466{ 12788{
12467 /* set as output */ 12789 alc_set_pin_output(codec, nid, pin_type);
12468 snd_hda_codec_write(codec, nid, 0,
12469 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
12470 snd_hda_codec_write(codec, nid, 0,
12471 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
12472} 12790}
12473 12791
12474static void alc861vd_auto_init_multi_out(struct hda_codec *codec) 12792static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
@@ -12495,6 +12813,9 @@ static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
12495 pin = spec->autocfg.hp_pins[0]; 12813 pin = spec->autocfg.hp_pins[0];
12496 if (pin) /* connect to front and use dac 0 */ 12814 if (pin) /* connect to front and use dac 0 */
12497 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); 12815 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
12816 pin = spec->autocfg.speaker_pins[0];
12817 if (pin)
12818 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
12498} 12819}
12499 12820
12500#define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) 12821#define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
@@ -12698,9 +13019,12 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec)
12698/* additional initialization for auto-configuration model */ 13019/* additional initialization for auto-configuration model */
12699static void alc861vd_auto_init(struct hda_codec *codec) 13020static void alc861vd_auto_init(struct hda_codec *codec)
12700{ 13021{
13022 struct alc_spec *spec = codec->spec;
12701 alc861vd_auto_init_multi_out(codec); 13023 alc861vd_auto_init_multi_out(codec);
12702 alc861vd_auto_init_hp_out(codec); 13024 alc861vd_auto_init_hp_out(codec);
12703 alc861vd_auto_init_analog_input(codec); 13025 alc861vd_auto_init_analog_input(codec);
13026 if (spec->unsol_event)
13027 alc_sku_automute(codec);
12704} 13028}
12705 13029
12706static int patch_alc861vd(struct hda_codec *codec) 13030static int patch_alc861vd(struct hda_codec *codec)
@@ -12751,6 +13075,7 @@ static int patch_alc861vd(struct hda_codec *codec)
12751 13075
12752 spec->adc_nids = alc861vd_adc_nids; 13076 spec->adc_nids = alc861vd_adc_nids;
12753 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); 13077 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
13078 spec->capsrc_nids = alc861vd_capsrc_nids;
12754 13079
12755 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; 13080 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
12756 spec->num_mixers++; 13081 spec->num_mixers++;
@@ -12792,9 +13117,11 @@ static hda_nid_t alc662_adc_nids[1] = {
12792 /* ADC1-2 */ 13117 /* ADC1-2 */
12793 0x09, 13118 0x09,
12794}; 13119};
13120
13121static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
13122
12795/* input MUX */ 13123/* input MUX */
12796/* FIXME: should be a matrix-type input source selection */ 13124/* FIXME: should be a matrix-type input source selection */
12797
12798static struct hda_input_mux alc662_capture_source = { 13125static struct hda_input_mux alc662_capture_source = {
12799 .num_items = 4, 13126 .num_items = 4,
12800 .items = { 13127 .items = {
@@ -12823,33 +13150,8 @@ static struct hda_input_mux alc662_eeepc_capture_source = {
12823 13150
12824#define alc662_mux_enum_info alc_mux_enum_info 13151#define alc662_mux_enum_info alc_mux_enum_info
12825#define alc662_mux_enum_get alc_mux_enum_get 13152#define alc662_mux_enum_get alc_mux_enum_get
13153#define alc662_mux_enum_put alc882_mux_enum_put
12826 13154
12827static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol,
12828 struct snd_ctl_elem_value *ucontrol)
12829{
12830 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12831 struct alc_spec *spec = codec->spec;
12832 const struct hda_input_mux *imux = spec->input_mux;
12833 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
12834 static hda_nid_t capture_mixers[2] = { 0x23, 0x22 };
12835 hda_nid_t nid = capture_mixers[adc_idx];
12836 unsigned int *cur_val = &spec->cur_mux[adc_idx];
12837 unsigned int i, idx;
12838
12839 idx = ucontrol->value.enumerated.item[0];
12840 if (idx >= imux->num_items)
12841 idx = imux->num_items - 1;
12842 if (*cur_val == idx)
12843 return 0;
12844 for (i = 0; i < imux->num_items; i++) {
12845 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
12846 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
12847 imux->items[i].index,
12848 HDA_AMP_MUTE, v);
12849 }
12850 *cur_val = idx;
12851 return 1;
12852}
12853/* 13155/*
12854 * 2ch mode 13156 * 2ch mode
12855 */ 13157 */
@@ -12918,13 +13220,13 @@ static struct hda_channel_mode alc662_5stack_modes[2] = {
12918static struct snd_kcontrol_new alc662_base_mixer[] = { 13220static struct snd_kcontrol_new alc662_base_mixer[] = {
12919 /* output mixer control */ 13221 /* output mixer control */
12920 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), 13222 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12921 HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT), 13223 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
12922 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), 13224 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12923 HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT), 13225 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
12924 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), 13226 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
12925 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), 13227 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
12926 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), 13228 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
12927 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), 13229 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
12928 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 13230 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12929 13231
12930 /*Input mixer control */ 13232 /*Input mixer control */
@@ -12941,7 +13243,7 @@ static struct snd_kcontrol_new alc662_base_mixer[] = {
12941 13243
12942static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { 13244static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
12943 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), 13245 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12944 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), 13246 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
12945 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 13247 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12946 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 13248 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12947 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 13249 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
@@ -12958,13 +13260,13 @@ static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
12958 13260
12959static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { 13261static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
12960 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), 13262 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12961 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), 13263 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
12962 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), 13264 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12963 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), 13265 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
12964 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), 13266 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
12965 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), 13267 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
12966 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), 13268 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
12967 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), 13269 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
12968 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 13270 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12969 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 13271 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12970 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 13272 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
@@ -13313,6 +13615,7 @@ static const char *alc662_models[ALC662_MODEL_LAST] = {
13313}; 13615};
13314 13616
13315static struct snd_pci_quirk alc662_cfg_tbl[] = { 13617static struct snd_pci_quirk alc662_cfg_tbl[] = {
13618 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
13316 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), 13619 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
13317 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), 13620 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
13318 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), 13621 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
@@ -13326,8 +13629,6 @@ static struct alc_config_preset alc662_presets[] = {
13326 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 13629 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13327 .dac_nids = alc662_dac_nids, 13630 .dac_nids = alc662_dac_nids,
13328 .dig_out_nid = ALC662_DIGOUT_NID, 13631 .dig_out_nid = ALC662_DIGOUT_NID,
13329 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13330 .adc_nids = alc662_adc_nids,
13331 .dig_in_nid = ALC662_DIGIN_NID, 13632 .dig_in_nid = ALC662_DIGIN_NID,
13332 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 13633 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13333 .channel_mode = alc662_3ST_2ch_modes, 13634 .channel_mode = alc662_3ST_2ch_modes,
@@ -13340,8 +13641,6 @@ static struct alc_config_preset alc662_presets[] = {
13340 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 13641 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13341 .dac_nids = alc662_dac_nids, 13642 .dac_nids = alc662_dac_nids,
13342 .dig_out_nid = ALC662_DIGOUT_NID, 13643 .dig_out_nid = ALC662_DIGOUT_NID,
13343 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13344 .adc_nids = alc662_adc_nids,
13345 .dig_in_nid = ALC662_DIGIN_NID, 13644 .dig_in_nid = ALC662_DIGIN_NID,
13346 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), 13645 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13347 .channel_mode = alc662_3ST_6ch_modes, 13646 .channel_mode = alc662_3ST_6ch_modes,
@@ -13354,8 +13653,6 @@ static struct alc_config_preset alc662_presets[] = {
13354 .init_verbs = { alc662_init_verbs }, 13653 .init_verbs = { alc662_init_verbs },
13355 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 13654 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13356 .dac_nids = alc662_dac_nids, 13655 .dac_nids = alc662_dac_nids,
13357 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13358 .adc_nids = alc662_adc_nids,
13359 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), 13656 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13360 .channel_mode = alc662_3ST_6ch_modes, 13657 .channel_mode = alc662_3ST_6ch_modes,
13361 .need_dac_fix = 1, 13658 .need_dac_fix = 1,
@@ -13368,8 +13665,6 @@ static struct alc_config_preset alc662_presets[] = {
13368 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 13665 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13369 .dac_nids = alc662_dac_nids, 13666 .dac_nids = alc662_dac_nids,
13370 .dig_out_nid = ALC662_DIGOUT_NID, 13667 .dig_out_nid = ALC662_DIGOUT_NID,
13371 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13372 .adc_nids = alc662_adc_nids,
13373 .dig_in_nid = ALC662_DIGIN_NID, 13668 .dig_in_nid = ALC662_DIGIN_NID,
13374 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), 13669 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
13375 .channel_mode = alc662_5stack_modes, 13670 .channel_mode = alc662_5stack_modes,
@@ -13380,8 +13675,6 @@ static struct alc_config_preset alc662_presets[] = {
13380 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, 13675 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
13381 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 13676 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13382 .dac_nids = alc662_dac_nids, 13677 .dac_nids = alc662_dac_nids,
13383 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13384 .adc_nids = alc662_adc_nids,
13385 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 13678 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13386 .channel_mode = alc662_3ST_2ch_modes, 13679 .channel_mode = alc662_3ST_2ch_modes,
13387 .input_mux = &alc662_lenovo_101e_capture_source, 13680 .input_mux = &alc662_lenovo_101e_capture_source,
@@ -13394,8 +13687,6 @@ static struct alc_config_preset alc662_presets[] = {
13394 alc662_eeepc_sue_init_verbs }, 13687 alc662_eeepc_sue_init_verbs },
13395 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 13688 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13396 .dac_nids = alc662_dac_nids, 13689 .dac_nids = alc662_dac_nids,
13397 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
13398 .adc_nids = alc662_adc_nids,
13399 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 13690 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13400 .channel_mode = alc662_3ST_2ch_modes, 13691 .channel_mode = alc662_3ST_2ch_modes,
13401 .input_mux = &alc662_eeepc_capture_source, 13692 .input_mux = &alc662_eeepc_capture_source,
@@ -13409,8 +13700,6 @@ static struct alc_config_preset alc662_presets[] = {
13409 alc662_eeepc_ep20_sue_init_verbs }, 13700 alc662_eeepc_ep20_sue_init_verbs },
13410 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 13701 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13411 .dac_nids = alc662_dac_nids, 13702 .dac_nids = alc662_dac_nids,
13412 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13413 .adc_nids = alc662_adc_nids,
13414 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), 13703 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13415 .channel_mode = alc662_3ST_6ch_modes, 13704 .channel_mode = alc662_3ST_6ch_modes,
13416 .input_mux = &alc662_lenovo_101e_capture_source, 13705 .input_mux = &alc662_lenovo_101e_capture_source,
@@ -13556,11 +13845,7 @@ static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
13556 hda_nid_t nid, int pin_type, 13845 hda_nid_t nid, int pin_type,
13557 int dac_idx) 13846 int dac_idx)
13558{ 13847{
13559 /* set as output */ 13848 alc_set_pin_output(codec, nid, pin_type);
13560 snd_hda_codec_write(codec, nid, 0,
13561 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
13562 snd_hda_codec_write(codec, nid, 0,
13563 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
13564 /* need the manual connection? */ 13849 /* need the manual connection? */
13565 if (alc880_is_multi_pin(nid)) { 13850 if (alc880_is_multi_pin(nid)) {
13566 struct alc_spec *spec = codec->spec; 13851 struct alc_spec *spec = codec->spec;
@@ -13595,6 +13880,9 @@ static void alc662_auto_init_hp_out(struct hda_codec *codec)
13595 if (pin) /* connect to front */ 13880 if (pin) /* connect to front */
13596 /* use dac 0 */ 13881 /* use dac 0 */
13597 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); 13882 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
13883 pin = spec->autocfg.speaker_pins[0];
13884 if (pin)
13885 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13598} 13886}
13599 13887
13600#define alc662_is_input_pin(nid) alc880_is_input_pin(nid) 13888#define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
@@ -13672,9 +13960,12 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
13672/* additional initialization for auto-configuration model */ 13960/* additional initialization for auto-configuration model */
13673static void alc662_auto_init(struct hda_codec *codec) 13961static void alc662_auto_init(struct hda_codec *codec)
13674{ 13962{
13963 struct alc_spec *spec = codec->spec;
13675 alc662_auto_init_multi_out(codec); 13964 alc662_auto_init_multi_out(codec);
13676 alc662_auto_init_hp_out(codec); 13965 alc662_auto_init_hp_out(codec);
13677 alc662_auto_init_analog_input(codec); 13966 alc662_auto_init_analog_input(codec);
13967 if (spec->unsol_event)
13968 alc_sku_automute(codec);
13678} 13969}
13679 13970
13680static int patch_alc662(struct hda_codec *codec) 13971static int patch_alc662(struct hda_codec *codec)
@@ -13722,10 +14013,9 @@ static int patch_alc662(struct hda_codec *codec)
13722 spec->stream_digital_playback = &alc662_pcm_digital_playback; 14013 spec->stream_digital_playback = &alc662_pcm_digital_playback;
13723 spec->stream_digital_capture = &alc662_pcm_digital_capture; 14014 spec->stream_digital_capture = &alc662_pcm_digital_capture;
13724 14015
13725 if (!spec->adc_nids && spec->input_mux) { 14016 spec->adc_nids = alc662_adc_nids;
13726 spec->adc_nids = alc662_adc_nids; 14017 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
13727 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); 14018 spec->capsrc_nids = alc662_capsrc_nids;
13728 }
13729 14019
13730 spec->vmaster_nid = 0x02; 14020 spec->vmaster_nid = 0x02;
13731 14021
@@ -13761,6 +14051,8 @@ struct hda_codec_preset snd_hda_preset_realtek[] = {
13761 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, 14051 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
13762 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, 14052 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
13763 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, 14053 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
14054 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
14055 .patch = patch_alc882 }, /* should be patch_alc883() in future */
13764 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, 14056 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
13765 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, 14057 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
13766 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, 14058 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },