aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-12-21 06:05:31 -0500
committerTakashi Iwai <tiwai@suse.de>2009-12-21 06:05:31 -0500
commita6c56f611ab72a3a44dff3f26ccf7f798f2c4233 (patch)
treeeda391dc0e650a33159cf2d67d4d4f7c6f4fee7e /sound
parent55639353a0035052d9ea6cfe4dde0ac7fcbb2c9f (diff)
parentde8853bc38ceab1fa7e7f723b21430d4aad60fea (diff)
Merge branch 'fix/hda' into for-linus
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_conexant.c43
-rw-r--r--sound/pci/hda/patch_realtek.c385
2 files changed, 391 insertions, 37 deletions
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index a09c03c3f62b..c578c28f368e 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -29,6 +29,7 @@
29 29
30#include "hda_codec.h" 30#include "hda_codec.h"
31#include "hda_local.h" 31#include "hda_local.h"
32#include "hda_beep.h"
32 33
33#define CXT_PIN_DIR_IN 0x00 34#define CXT_PIN_DIR_IN 0x00
34#define CXT_PIN_DIR_OUT 0x01 35#define CXT_PIN_DIR_OUT 0x01
@@ -111,6 +112,7 @@ struct conexant_spec {
111 unsigned int dell_automute; 112 unsigned int dell_automute;
112 unsigned int port_d_mode; 113 unsigned int port_d_mode;
113 unsigned char ext_mic_bias; 114 unsigned char ext_mic_bias;
115 unsigned int dell_vostro;
114}; 116};
115 117
116static int conexant_playback_pcm_open(struct hda_pcm_stream *hinfo, 118static int conexant_playback_pcm_open(struct hda_pcm_stream *hinfo,
@@ -476,6 +478,7 @@ static void conexant_free(struct hda_codec *codec)
476 snd_array_free(&spec->jacks); 478 snd_array_free(&spec->jacks);
477 } 479 }
478#endif 480#endif
481 snd_hda_detach_beep_device(codec);
479 kfree(codec->spec); 482 kfree(codec->spec);
480} 483}
481 484
@@ -2109,9 +2112,12 @@ static int cxt5066_mic_boost_mux_enum_get(struct snd_kcontrol *kcontrol,
2109{ 2112{
2110 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 2113 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2111 int val; 2114 int val;
2115 hda_nid_t nid = kcontrol->private_value & 0xff;
2116 int inout = (kcontrol->private_value & 0x100) ?
2117 AC_AMP_GET_INPUT : AC_AMP_GET_OUTPUT;
2112 2118
2113 val = snd_hda_codec_read(codec, 0x17, 0, 2119 val = snd_hda_codec_read(codec, nid, 0,
2114 AC_VERB_GET_AMP_GAIN_MUTE, AC_AMP_GET_OUTPUT); 2120 AC_VERB_GET_AMP_GAIN_MUTE, inout);
2115 2121
2116 ucontrol->value.enumerated.item[0] = val & AC_AMP_GAIN; 2122 ucontrol->value.enumerated.item[0] = val & AC_AMP_GAIN;
2117 return 0; 2123 return 0;
@@ -2123,6 +2129,9 @@ static int cxt5066_mic_boost_mux_enum_put(struct snd_kcontrol *kcontrol,
2123 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 2129 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2124 const struct hda_input_mux *imux = &cxt5066_analog_mic_boost; 2130 const struct hda_input_mux *imux = &cxt5066_analog_mic_boost;
2125 unsigned int idx; 2131 unsigned int idx;
2132 hda_nid_t nid = kcontrol->private_value & 0xff;
2133 int inout = (kcontrol->private_value & 0x100) ?
2134 AC_AMP_SET_INPUT : AC_AMP_SET_OUTPUT;
2126 2135
2127 if (!imux->num_items) 2136 if (!imux->num_items)
2128 return 0; 2137 return 0;
@@ -2130,9 +2139,9 @@ static int cxt5066_mic_boost_mux_enum_put(struct snd_kcontrol *kcontrol,
2130 if (idx >= imux->num_items) 2139 if (idx >= imux->num_items)
2131 idx = imux->num_items - 1; 2140 idx = imux->num_items - 1;
2132 2141
2133 snd_hda_codec_write_cache(codec, 0x17, 0, 2142 snd_hda_codec_write_cache(codec, nid, 0,
2134 AC_VERB_SET_AMP_GAIN_MUTE, 2143 AC_VERB_SET_AMP_GAIN_MUTE,
2135 AC_AMP_SET_RIGHT | AC_AMP_SET_LEFT | AC_AMP_SET_OUTPUT | 2144 AC_AMP_SET_RIGHT | AC_AMP_SET_LEFT | inout |
2136 imux->items[idx].index); 2145 imux->items[idx].index);
2137 2146
2138 return 1; 2147 return 1;
@@ -2201,10 +2210,11 @@ static struct snd_kcontrol_new cxt5066_mixers[] = {
2201 2210
2202 { 2211 {
2203 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2212 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2204 .name = "Analog Mic Boost Capture Enum", 2213 .name = "Ext Mic Boost Capture Enum",
2205 .info = cxt5066_mic_boost_mux_enum_info, 2214 .info = cxt5066_mic_boost_mux_enum_info,
2206 .get = cxt5066_mic_boost_mux_enum_get, 2215 .get = cxt5066_mic_boost_mux_enum_get,
2207 .put = cxt5066_mic_boost_mux_enum_put, 2216 .put = cxt5066_mic_boost_mux_enum_put,
2217 .private_value = 0x17,
2208 }, 2218 },
2209 2219
2210 HDA_BIND_VOL("Capture Volume", &cxt5066_bind_capture_vol_others), 2220 HDA_BIND_VOL("Capture Volume", &cxt5066_bind_capture_vol_others),
@@ -2212,6 +2222,19 @@ static struct snd_kcontrol_new cxt5066_mixers[] = {
2212 {} 2222 {}
2213}; 2223};
2214 2224
2225static struct snd_kcontrol_new cxt5066_vostro_mixers[] = {
2226 {
2227 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2228 .name = "Int Mic Boost Capture Enum",
2229 .info = cxt5066_mic_boost_mux_enum_info,
2230 .get = cxt5066_mic_boost_mux_enum_get,
2231 .put = cxt5066_mic_boost_mux_enum_put,
2232 .private_value = 0x23 | 0x100,
2233 },
2234 HDA_CODEC_VOLUME_MONO("Beep Playback Volume", 0x13, 1, 0x0, HDA_OUTPUT),
2235 {}
2236};
2237
2215static struct hda_verb cxt5066_init_verbs[] = { 2238static struct hda_verb cxt5066_init_verbs[] = {
2216 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port B */ 2239 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port B */
2217 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port C */ 2240 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port C */
@@ -2397,11 +2420,16 @@ static struct hda_verb cxt5066_init_verbs_portd_lo[] = {
2397/* initialize jack-sensing, too */ 2420/* initialize jack-sensing, too */
2398static int cxt5066_init(struct hda_codec *codec) 2421static int cxt5066_init(struct hda_codec *codec)
2399{ 2422{
2423 struct conexant_spec *spec = codec->spec;
2424
2400 snd_printdd("CXT5066: init\n"); 2425 snd_printdd("CXT5066: init\n");
2401 conexant_init(codec); 2426 conexant_init(codec);
2402 if (codec->patch_ops.unsol_event) { 2427 if (codec->patch_ops.unsol_event) {
2403 cxt5066_hp_automute(codec); 2428 cxt5066_hp_automute(codec);
2404 cxt5066_automic(codec); 2429 if (spec->dell_vostro)
2430 cxt5066_vostro_automic(codec);
2431 else
2432 cxt5066_automic(codec);
2405 } 2433 }
2406 return 0; 2434 return 0;
2407} 2435}
@@ -2500,7 +2528,10 @@ static int patch_cxt5066(struct hda_codec *codec)
2500 spec->init_verbs[0] = cxt5066_init_verbs_vostro; 2528 spec->init_verbs[0] = cxt5066_init_verbs_vostro;
2501 spec->mixers[spec->num_mixers++] = cxt5066_mixer_master_olpc; 2529 spec->mixers[spec->num_mixers++] = cxt5066_mixer_master_olpc;
2502 spec->mixers[spec->num_mixers++] = cxt5066_mixers; 2530 spec->mixers[spec->num_mixers++] = cxt5066_mixers;
2531 spec->mixers[spec->num_mixers++] = cxt5066_vostro_mixers;
2503 spec->port_d_mode = 0; 2532 spec->port_d_mode = 0;
2533 spec->dell_vostro = 1;
2534 snd_hda_attach_beep_device(codec, 0x13);
2504 2535
2505 /* no S/PDIF out */ 2536 /* no S/PDIF out */
2506 spec->multiout.dig_out_nid = 0; 2537 spec->multiout.dig_out_nid = 0;
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index aeed4cc5aa79..0877bae5dae1 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -131,8 +131,8 @@ enum {
131enum { 131enum {
132 ALC269_BASIC, 132 ALC269_BASIC,
133 ALC269_QUANTA_FL1, 133 ALC269_QUANTA_FL1,
134 ALC269_ASUS_EEEPC_P703, 134 ALC269_ASUS_AMIC,
135 ALC269_ASUS_EEEPC_P901, 135 ALC269_ASUS_DMIC,
136 ALC269_FUJITSU, 136 ALC269_FUJITSU,
137 ALC269_LIFEBOOK, 137 ALC269_LIFEBOOK,
138 ALC269_AUTO, 138 ALC269_AUTO,
@@ -188,6 +188,8 @@ enum {
188 ALC663_ASUS_MODE4, 188 ALC663_ASUS_MODE4,
189 ALC663_ASUS_MODE5, 189 ALC663_ASUS_MODE5,
190 ALC663_ASUS_MODE6, 190 ALC663_ASUS_MODE6,
191 ALC663_ASUS_MODE7,
192 ALC663_ASUS_MODE8,
191 ALC272_DELL, 193 ALC272_DELL,
192 ALC272_DELL_ZM1, 194 ALC272_DELL_ZM1,
193 ALC272_SAMSUNG_NC10, 195 ALC272_SAMSUNG_NC10,
@@ -335,6 +337,9 @@ struct alc_spec {
335 /* hooks */ 337 /* hooks */
336 void (*init_hook)(struct hda_codec *codec); 338 void (*init_hook)(struct hda_codec *codec);
337 void (*unsol_event)(struct hda_codec *codec, unsigned int res); 339 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
340#ifdef CONFIG_SND_HDA_POWER_SAVE
341 void (*power_hook)(struct hda_codec *codec, int power);
342#endif
338 343
339 /* for pin sensing */ 344 /* for pin sensing */
340 unsigned int sense_updated: 1; 345 unsigned int sense_updated: 1;
@@ -386,6 +391,7 @@ struct alc_config_preset {
386 void (*init_hook)(struct hda_codec *); 391 void (*init_hook)(struct hda_codec *);
387#ifdef CONFIG_SND_HDA_POWER_SAVE 392#ifdef CONFIG_SND_HDA_POWER_SAVE
388 struct hda_amp_list *loopbacks; 393 struct hda_amp_list *loopbacks;
394 void (*power_hook)(struct hda_codec *codec, int power);
389#endif 395#endif
390}; 396};
391 397
@@ -898,6 +904,7 @@ static void setup_preset(struct hda_codec *codec,
898 spec->unsol_event = preset->unsol_event; 904 spec->unsol_event = preset->unsol_event;
899 spec->init_hook = preset->init_hook; 905 spec->init_hook = preset->init_hook;
900#ifdef CONFIG_SND_HDA_POWER_SAVE 906#ifdef CONFIG_SND_HDA_POWER_SAVE
907 spec->power_hook = preset->power_hook;
901 spec->loopback.amplist = preset->loopbacks; 908 spec->loopback.amplist = preset->loopbacks;
902#endif 909#endif
903 910
@@ -1663,9 +1670,6 @@ static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1663/* some bit here disables the other DACs. Init=0x4900 */ 1670/* some bit here disables the other DACs. Init=0x4900 */
1664 {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, 1671 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1665 {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, 1672 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1666/* Enable amplifiers */
1667 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1668 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1669/* DMIC fix 1673/* DMIC fix
1670 * This laptop has a stereo digital microphone. The mics are only 1cm apart 1674 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1671 * which makes the stereo useless. However, either the mic or the ALC889 1675 * which makes the stereo useless. However, either the mic or the ALC889
@@ -1778,6 +1782,25 @@ static struct snd_kcontrol_new alc888_base_mixer[] = {
1778 { } /* end */ 1782 { } /* end */
1779}; 1783};
1780 1784
1785static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1786 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1787 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1788 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1789 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1790 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1791 HDA_OUTPUT),
1792 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1793 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1794 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1795 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1796 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1797 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1798 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1799 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1800 { } /* end */
1801};
1802
1803
1781static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) 1804static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1782{ 1805{
1783 struct alc_spec *spec = codec->spec; 1806 struct alc_spec *spec = codec->spec;
@@ -1808,6 +1831,16 @@ static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1808 spec->autocfg.speaker_pins[2] = 0x1b; 1831 spec->autocfg.speaker_pins[2] = 0x1b;
1809} 1832}
1810 1833
1834#ifdef CONFIG_SND_HDA_POWER_SAVE
1835static void alc889_power_eapd(struct hda_codec *codec, int power)
1836{
1837 snd_hda_codec_write(codec, 0x14, 0,
1838 AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0);
1839 snd_hda_codec_write(codec, 0x15, 0,
1840 AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0);
1841}
1842#endif
1843
1811/* 1844/*
1812 * ALC880 3-stack model 1845 * ALC880 3-stack model
1813 * 1846 *
@@ -3601,12 +3634,29 @@ static void alc_free(struct hda_codec *codec)
3601 snd_hda_detach_beep_device(codec); 3634 snd_hda_detach_beep_device(codec);
3602} 3635}
3603 3636
3637#ifdef CONFIG_SND_HDA_POWER_SAVE
3638static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3639{
3640 struct alc_spec *spec = codec->spec;
3641 if (spec && spec->power_hook)
3642 spec->power_hook(codec, 0);
3643 return 0;
3644}
3645#endif
3646
3604#ifdef SND_HDA_NEEDS_RESUME 3647#ifdef SND_HDA_NEEDS_RESUME
3605static int alc_resume(struct hda_codec *codec) 3648static int alc_resume(struct hda_codec *codec)
3606{ 3649{
3650#ifdef CONFIG_SND_HDA_POWER_SAVE
3651 struct alc_spec *spec = codec->spec;
3652#endif
3607 codec->patch_ops.init(codec); 3653 codec->patch_ops.init(codec);
3608 snd_hda_codec_resume_amp(codec); 3654 snd_hda_codec_resume_amp(codec);
3609 snd_hda_codec_resume_cache(codec); 3655 snd_hda_codec_resume_cache(codec);
3656#ifdef CONFIG_SND_HDA_POWER_SAVE
3657 if (spec && spec->power_hook)
3658 spec->power_hook(codec, 1);
3659#endif
3610 return 0; 3660 return 0;
3611} 3661}
3612#endif 3662#endif
@@ -3623,6 +3673,7 @@ static struct hda_codec_ops alc_patch_ops = {
3623 .resume = alc_resume, 3673 .resume = alc_resume,
3624#endif 3674#endif
3625#ifdef CONFIG_SND_HDA_POWER_SAVE 3675#ifdef CONFIG_SND_HDA_POWER_SAVE
3676 .suspend = alc_suspend,
3626 .check_power_status = alc_check_power_status, 3677 .check_power_status = alc_check_power_status,
3627#endif 3678#endif
3628}; 3679};
@@ -8919,7 +8970,7 @@ static struct snd_pci_quirk alc882_cfg_tbl[] = {
8919 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), 8970 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8920 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), 8971 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8921 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ 8972 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8922 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), 8973 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
8923 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), 8974 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8924 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), 8975 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8925 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), 8976 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
@@ -9282,6 +9333,7 @@ static struct alc_config_preset alc882_presets[] = {
9282 .dac_nids = alc883_dac_nids, 9333 .dac_nids = alc883_dac_nids,
9283 .adc_nids = alc883_adc_nids_alt, 9334 .adc_nids = alc883_adc_nids_alt,
9284 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), 9335 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9336 .capsrc_nids = alc883_capsrc_nids,
9285 .dig_out_nid = ALC883_DIGOUT_NID, 9337 .dig_out_nid = ALC883_DIGOUT_NID,
9286 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 9338 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9287 .channel_mode = alc883_3ST_2ch_modes, 9339 .channel_mode = alc883_3ST_2ch_modes,
@@ -9378,10 +9430,11 @@ static struct alc_config_preset alc882_presets[] = {
9378 .init_hook = alc_automute_amp, 9430 .init_hook = alc_automute_amp,
9379 }, 9431 },
9380 [ALC888_ACER_ASPIRE_8930G] = { 9432 [ALC888_ACER_ASPIRE_8930G] = {
9381 .mixers = { alc888_base_mixer, 9433 .mixers = { alc889_acer_aspire_8930g_mixer,
9382 alc883_chmode_mixer }, 9434 alc883_chmode_mixer },
9383 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, 9435 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9384 alc889_acer_aspire_8930g_verbs }, 9436 alc889_acer_aspire_8930g_verbs,
9437 alc889_eapd_verbs},
9385 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 9438 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9386 .dac_nids = alc883_dac_nids, 9439 .dac_nids = alc883_dac_nids,
9387 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), 9440 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
@@ -9398,6 +9451,9 @@ static struct alc_config_preset alc882_presets[] = {
9398 .unsol_event = alc_automute_amp_unsol_event, 9451 .unsol_event = alc_automute_amp_unsol_event,
9399 .setup = alc889_acer_aspire_8930g_setup, 9452 .setup = alc889_acer_aspire_8930g_setup,
9400 .init_hook = alc_automute_amp, 9453 .init_hook = alc_automute_amp,
9454#ifdef CONFIG_SND_HDA_POWER_SAVE
9455 .power_hook = alc889_power_eapd,
9456#endif
9401 }, 9457 },
9402 [ALC888_ACER_ASPIRE_7730G] = { 9458 [ALC888_ACER_ASPIRE_7730G] = {
9403 .mixers = { alc883_3ST_6ch_mixer, 9459 .mixers = { alc883_3ST_6ch_mixer,
@@ -9428,6 +9484,7 @@ static struct alc_config_preset alc882_presets[] = {
9428 .dac_nids = alc883_dac_nids, 9484 .dac_nids = alc883_dac_nids,
9429 .adc_nids = alc883_adc_nids_alt, 9485 .adc_nids = alc883_adc_nids_alt,
9430 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), 9486 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9487 .capsrc_nids = alc883_capsrc_nids,
9431 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), 9488 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9432 .channel_mode = alc883_sixstack_modes, 9489 .channel_mode = alc883_sixstack_modes,
9433 .input_mux = &alc883_capture_source, 9490 .input_mux = &alc883_capture_source,
@@ -9489,6 +9546,7 @@ static struct alc_config_preset alc882_presets[] = {
9489 .dac_nids = alc883_dac_nids, 9546 .dac_nids = alc883_dac_nids,
9490 .adc_nids = alc883_adc_nids_alt, 9547 .adc_nids = alc883_adc_nids_alt,
9491 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), 9548 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9549 .capsrc_nids = alc883_capsrc_nids,
9492 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 9550 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9493 .channel_mode = alc883_3ST_2ch_modes, 9551 .channel_mode = alc883_3ST_2ch_modes,
9494 .input_mux = &alc883_lenovo_101e_capture_source, 9552 .input_mux = &alc883_lenovo_101e_capture_source,
@@ -9668,6 +9726,7 @@ static struct alc_config_preset alc882_presets[] = {
9668 alc880_gpio1_init_verbs }, 9726 alc880_gpio1_init_verbs },
9669 .adc_nids = alc883_adc_nids, 9727 .adc_nids = alc883_adc_nids,
9670 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), 9728 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9729 .capsrc_nids = alc883_capsrc_nids,
9671 .dac_nids = alc883_dac_nids, 9730 .dac_nids = alc883_dac_nids,
9672 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 9731 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9673 .channel_mode = alc889A_mb31_6ch_modes, 9732 .channel_mode = alc889A_mb31_6ch_modes,
@@ -10678,6 +10737,13 @@ static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10678 {} 10737 {}
10679}; 10738};
10680 10739
10740static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
10741 /* Front Mic pin: input vref at 50% */
10742 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10743 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10744 {}
10745};
10746
10681static struct hda_input_mux alc262_fujitsu_capture_source = { 10747static struct hda_input_mux alc262_fujitsu_capture_source = {
10682 .num_items = 3, 10748 .num_items = 3,
10683 .items = { 10749 .items = {
@@ -11720,7 +11786,8 @@ static struct alc_config_preset alc262_presets[] = {
11720 [ALC262_LENOVO_3000] = { 11786 [ALC262_LENOVO_3000] = {
11721 .mixers = { alc262_lenovo_3000_mixer }, 11787 .mixers = { alc262_lenovo_3000_mixer },
11722 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, 11788 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11723 alc262_lenovo_3000_unsol_verbs }, 11789 alc262_lenovo_3000_unsol_verbs,
11790 alc262_lenovo_3000_init_verbs },
11724 .num_dacs = ARRAY_SIZE(alc262_dac_nids), 11791 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11725 .dac_nids = alc262_dac_nids, 11792 .dac_nids = alc262_dac_nids,
11726 .hp_nid = 0x03, 11793 .hp_nid = 0x03,
@@ -13232,10 +13299,12 @@ static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13232/* toggle speaker-output according to the hp-jack state */ 13299/* toggle speaker-output according to the hp-jack state */
13233static void alc269_speaker_automute(struct hda_codec *codec) 13300static void alc269_speaker_automute(struct hda_codec *codec)
13234{ 13301{
13302 struct alc_spec *spec = codec->spec;
13303 unsigned int nid = spec->autocfg.hp_pins[0];
13235 unsigned int present; 13304 unsigned int present;
13236 unsigned char bits; 13305 unsigned char bits;
13237 13306
13238 present = snd_hda_jack_detect(codec, 0x15); 13307 present = snd_hda_jack_detect(codec, nid);
13239 bits = present ? AMP_IN_MUTE(0) : 0; 13308 bits = present ? AMP_IN_MUTE(0) : 0;
13240 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, 13309 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13241 AMP_IN_MUTE(0), bits); 13310 AMP_IN_MUTE(0), bits);
@@ -13460,8 +13529,8 @@ static void alc269_auto_init(struct hda_codec *codec)
13460static const char *alc269_models[ALC269_MODEL_LAST] = { 13529static const char *alc269_models[ALC269_MODEL_LAST] = {
13461 [ALC269_BASIC] = "basic", 13530 [ALC269_BASIC] = "basic",
13462 [ALC269_QUANTA_FL1] = "quanta", 13531 [ALC269_QUANTA_FL1] = "quanta",
13463 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", 13532 [ALC269_ASUS_AMIC] = "asus-amic",
13464 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", 13533 [ALC269_ASUS_DMIC] = "asus-dmic",
13465 [ALC269_FUJITSU] = "fujitsu", 13534 [ALC269_FUJITSU] = "fujitsu",
13466 [ALC269_LIFEBOOK] = "lifebook", 13535 [ALC269_LIFEBOOK] = "lifebook",
13467 [ALC269_AUTO] = "auto", 13536 [ALC269_AUTO] = "auto",
@@ -13470,18 +13539,41 @@ static const char *alc269_models[ALC269_MODEL_LAST] = {
13470static struct snd_pci_quirk alc269_cfg_tbl[] = { 13539static struct snd_pci_quirk alc269_cfg_tbl[] = {
13471 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), 13540 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13472 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", 13541 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13473 ALC269_ASUS_EEEPC_P703), 13542 ALC269_ASUS_AMIC),
13474 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), 13543 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC),
13475 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), 13544 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC),
13476 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), 13545 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC),
13477 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), 13546 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC),
13478 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), 13547 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC),
13479 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), 13548 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC),
13549 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC),
13550 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC),
13551 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC),
13552 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC),
13553 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC),
13554 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC),
13555 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC),
13556 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC),
13557 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC),
13558 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC),
13559 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC),
13560 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC),
13561 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC),
13562 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC),
13563 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC),
13564 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC),
13565 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC),
13566 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC),
13567 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC),
13568 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC),
13569 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC),
13570 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC),
13480 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", 13571 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13481 ALC269_ASUS_EEEPC_P901), 13572 ALC269_ASUS_DMIC),
13482 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", 13573 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13483 ALC269_ASUS_EEEPC_P901), 13574 ALC269_ASUS_DMIC),
13484 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), 13575 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC),
13576 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC),
13485 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), 13577 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13486 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), 13578 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13487 {} 13579 {}
@@ -13511,7 +13603,7 @@ static struct alc_config_preset alc269_presets[] = {
13511 .setup = alc269_quanta_fl1_setup, 13603 .setup = alc269_quanta_fl1_setup,
13512 .init_hook = alc269_quanta_fl1_init_hook, 13604 .init_hook = alc269_quanta_fl1_init_hook,
13513 }, 13605 },
13514 [ALC269_ASUS_EEEPC_P703] = { 13606 [ALC269_ASUS_AMIC] = {
13515 .mixers = { alc269_eeepc_mixer }, 13607 .mixers = { alc269_eeepc_mixer },
13516 .cap_mixer = alc269_epc_capture_mixer, 13608 .cap_mixer = alc269_epc_capture_mixer,
13517 .init_verbs = { alc269_init_verbs, 13609 .init_verbs = { alc269_init_verbs,
@@ -13525,7 +13617,7 @@ static struct alc_config_preset alc269_presets[] = {
13525 .setup = alc269_eeepc_amic_setup, 13617 .setup = alc269_eeepc_amic_setup,
13526 .init_hook = alc269_eeepc_inithook, 13618 .init_hook = alc269_eeepc_inithook,
13527 }, 13619 },
13528 [ALC269_ASUS_EEEPC_P901] = { 13620 [ALC269_ASUS_DMIC] = {
13529 .mixers = { alc269_eeepc_mixer }, 13621 .mixers = { alc269_eeepc_mixer },
13530 .cap_mixer = alc269_epc_capture_mixer, 13622 .cap_mixer = alc269_epc_capture_mixer,
13531 .init_verbs = { alc269_init_verbs, 13623 .init_verbs = { alc269_init_verbs,
@@ -16160,6 +16252,52 @@ static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16160 { } /* end */ 16252 { } /* end */
16161}; 16253};
16162 16254
16255static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16256 .ops = &snd_hda_bind_sw,
16257 .values = {
16258 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16259 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16260 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16261 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16262 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16263 0
16264 },
16265};
16266
16267static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16268 .ops = &snd_hda_bind_sw,
16269 .values = {
16270 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16271 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16272 0
16273 },
16274};
16275
16276static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16277 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16278 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16279 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16280 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16281 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16282 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16283 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16284 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16285 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16286 { } /* end */
16287};
16288
16289static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16290 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16291 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16292 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16293 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16294 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16295 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16296 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16297 { } /* end */
16298};
16299
16300
16163static struct snd_kcontrol_new alc662_chmode_mixer[] = { 16301static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16164 { 16302 {
16165 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 16303 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -16447,6 +16585,45 @@ static struct hda_verb alc272_dell_init_verbs[] = {
16447 {} 16585 {}
16448}; 16586};
16449 16587
16588static struct hda_verb alc663_mode7_init_verbs[] = {
16589 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16590 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16591 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16592 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16593 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16594 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16595 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
16596 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16597 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16598 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16599 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16600 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16601 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16602 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16603 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16604 {}
16605};
16606
16607static struct hda_verb alc663_mode8_init_verbs[] = {
16608 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16609 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16610 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16611 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16612 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16613 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16614 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16615 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16616 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16617 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16618 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16619 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16620 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16621 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16622 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16623 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16624 {}
16625};
16626
16450static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { 16627static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16451 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), 16628 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16452 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), 16629 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
@@ -16626,6 +16803,54 @@ static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16626 } 16803 }
16627} 16804}
16628 16805
16806static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
16807{
16808 unsigned int present1, present2;
16809
16810 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16811 AC_VERB_GET_PIN_SENSE, 0)
16812 & AC_PINSENSE_PRESENCE;
16813 present2 = snd_hda_codec_read(codec, 0x21, 0,
16814 AC_VERB_GET_PIN_SENSE, 0)
16815 & AC_PINSENSE_PRESENCE;
16816
16817 if (present1 || present2) {
16818 snd_hda_codec_write_cache(codec, 0x14, 0,
16819 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16820 snd_hda_codec_write_cache(codec, 0x17, 0,
16821 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16822 } else {
16823 snd_hda_codec_write_cache(codec, 0x14, 0,
16824 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16825 snd_hda_codec_write_cache(codec, 0x17, 0,
16826 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16827 }
16828}
16829
16830static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
16831{
16832 unsigned int present1, present2;
16833
16834 present1 = snd_hda_codec_read(codec, 0x21, 0,
16835 AC_VERB_GET_PIN_SENSE, 0)
16836 & AC_PINSENSE_PRESENCE;
16837 present2 = snd_hda_codec_read(codec, 0x15, 0,
16838 AC_VERB_GET_PIN_SENSE, 0)
16839 & AC_PINSENSE_PRESENCE;
16840
16841 if (present1 || present2) {
16842 snd_hda_codec_write_cache(codec, 0x14, 0,
16843 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16844 snd_hda_codec_write_cache(codec, 0x17, 0,
16845 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16846 } else {
16847 snd_hda_codec_write_cache(codec, 0x14, 0,
16848 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16849 snd_hda_codec_write_cache(codec, 0x17, 0,
16850 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16851 }
16852}
16853
16629static void alc663_m51va_unsol_event(struct hda_codec *codec, 16854static void alc663_m51va_unsol_event(struct hda_codec *codec,
16630 unsigned int res) 16855 unsigned int res)
16631{ 16856{
@@ -16645,7 +16870,7 @@ static void alc663_m51va_setup(struct hda_codec *codec)
16645 spec->ext_mic.pin = 0x18; 16870 spec->ext_mic.pin = 0x18;
16646 spec->ext_mic.mux_idx = 0; 16871 spec->ext_mic.mux_idx = 0;
16647 spec->int_mic.pin = 0x12; 16872 spec->int_mic.pin = 0x12;
16648 spec->int_mic.mux_idx = 1; 16873 spec->int_mic.mux_idx = 9;
16649 spec->auto_mic = 1; 16874 spec->auto_mic = 1;
16650} 16875}
16651 16876
@@ -16657,7 +16882,17 @@ static void alc663_m51va_inithook(struct hda_codec *codec)
16657 16882
16658/* ***************** Mode1 ******************************/ 16883/* ***************** Mode1 ******************************/
16659#define alc663_mode1_unsol_event alc663_m51va_unsol_event 16884#define alc663_mode1_unsol_event alc663_m51va_unsol_event
16660#define alc663_mode1_setup alc663_m51va_setup 16885
16886static void alc663_mode1_setup(struct hda_codec *codec)
16887{
16888 struct alc_spec *spec = codec->spec;
16889 spec->ext_mic.pin = 0x18;
16890 spec->ext_mic.mux_idx = 0;
16891 spec->int_mic.pin = 0x19;
16892 spec->int_mic.mux_idx = 1;
16893 spec->auto_mic = 1;
16894}
16895
16661#define alc663_mode1_inithook alc663_m51va_inithook 16896#define alc663_mode1_inithook alc663_m51va_inithook
16662 16897
16663/* ***************** Mode2 ******************************/ 16898/* ***************** Mode2 ******************************/
@@ -16674,7 +16909,7 @@ static void alc662_mode2_unsol_event(struct hda_codec *codec,
16674 } 16909 }
16675} 16910}
16676 16911
16677#define alc662_mode2_setup alc663_m51va_setup 16912#define alc662_mode2_setup alc663_mode1_setup
16678 16913
16679static void alc662_mode2_inithook(struct hda_codec *codec) 16914static void alc662_mode2_inithook(struct hda_codec *codec)
16680{ 16915{
@@ -16695,7 +16930,7 @@ static void alc663_mode3_unsol_event(struct hda_codec *codec,
16695 } 16930 }
16696} 16931}
16697 16932
16698#define alc663_mode3_setup alc663_m51va_setup 16933#define alc663_mode3_setup alc663_mode1_setup
16699 16934
16700static void alc663_mode3_inithook(struct hda_codec *codec) 16935static void alc663_mode3_inithook(struct hda_codec *codec)
16701{ 16936{
@@ -16716,7 +16951,7 @@ static void alc663_mode4_unsol_event(struct hda_codec *codec,
16716 } 16951 }
16717} 16952}
16718 16953
16719#define alc663_mode4_setup alc663_m51va_setup 16954#define alc663_mode4_setup alc663_mode1_setup
16720 16955
16721static void alc663_mode4_inithook(struct hda_codec *codec) 16956static void alc663_mode4_inithook(struct hda_codec *codec)
16722{ 16957{
@@ -16737,7 +16972,7 @@ static void alc663_mode5_unsol_event(struct hda_codec *codec,
16737 } 16972 }
16738} 16973}
16739 16974
16740#define alc663_mode5_setup alc663_m51va_setup 16975#define alc663_mode5_setup alc663_mode1_setup
16741 16976
16742static void alc663_mode5_inithook(struct hda_codec *codec) 16977static void alc663_mode5_inithook(struct hda_codec *codec)
16743{ 16978{
@@ -16758,7 +16993,7 @@ static void alc663_mode6_unsol_event(struct hda_codec *codec,
16758 } 16993 }
16759} 16994}
16760 16995
16761#define alc663_mode6_setup alc663_m51va_setup 16996#define alc663_mode6_setup alc663_mode1_setup
16762 16997
16763static void alc663_mode6_inithook(struct hda_codec *codec) 16998static void alc663_mode6_inithook(struct hda_codec *codec)
16764{ 16999{
@@ -16766,6 +17001,50 @@ static void alc663_mode6_inithook(struct hda_codec *codec)
16766 alc_mic_automute(codec); 17001 alc_mic_automute(codec);
16767} 17002}
16768 17003
17004/* ***************** Mode7 ******************************/
17005static void alc663_mode7_unsol_event(struct hda_codec *codec,
17006 unsigned int res)
17007{
17008 switch (res >> 26) {
17009 case ALC880_HP_EVENT:
17010 alc663_two_hp_m7_speaker_automute(codec);
17011 break;
17012 case ALC880_MIC_EVENT:
17013 alc_mic_automute(codec);
17014 break;
17015 }
17016}
17017
17018#define alc663_mode7_setup alc663_mode1_setup
17019
17020static void alc663_mode7_inithook(struct hda_codec *codec)
17021{
17022 alc663_two_hp_m7_speaker_automute(codec);
17023 alc_mic_automute(codec);
17024}
17025
17026/* ***************** Mode8 ******************************/
17027static void alc663_mode8_unsol_event(struct hda_codec *codec,
17028 unsigned int res)
17029{
17030 switch (res >> 26) {
17031 case ALC880_HP_EVENT:
17032 alc663_two_hp_m8_speaker_automute(codec);
17033 break;
17034 case ALC880_MIC_EVENT:
17035 alc_mic_automute(codec);
17036 break;
17037 }
17038}
17039
17040#define alc663_mode8_setup alc663_m51va_setup
17041
17042static void alc663_mode8_inithook(struct hda_codec *codec)
17043{
17044 alc663_two_hp_m8_speaker_automute(codec);
17045 alc_mic_automute(codec);
17046}
17047
16769static void alc663_g71v_hp_automute(struct hda_codec *codec) 17048static void alc663_g71v_hp_automute(struct hda_codec *codec)
16770{ 17049{
16771 unsigned int present; 17050 unsigned int present;
@@ -16900,6 +17179,8 @@ static const char *alc662_models[ALC662_MODEL_LAST] = {
16900 [ALC663_ASUS_MODE4] = "asus-mode4", 17179 [ALC663_ASUS_MODE4] = "asus-mode4",
16901 [ALC663_ASUS_MODE5] = "asus-mode5", 17180 [ALC663_ASUS_MODE5] = "asus-mode5",
16902 [ALC663_ASUS_MODE6] = "asus-mode6", 17181 [ALC663_ASUS_MODE6] = "asus-mode6",
17182 [ALC663_ASUS_MODE7] = "asus-mode7",
17183 [ALC663_ASUS_MODE8] = "asus-mode8",
16903 [ALC272_DELL] = "dell", 17184 [ALC272_DELL] = "dell",
16904 [ALC272_DELL_ZM1] = "dell-zm1", 17185 [ALC272_DELL_ZM1] = "dell-zm1",
16905 [ALC272_SAMSUNG_NC10] = "samsung-nc10", 17186 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
@@ -16916,12 +17197,22 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
16916 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), 17197 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16917 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), 17198 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16918 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), 17199 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17200 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17201 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
16919 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), 17202 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17203 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17204 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17205 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17206 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17207 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
16920 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), 17208 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17209 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17210 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
16921 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), 17211 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16922 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), 17212 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16923 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), 17213 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16924 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), 17214 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17215 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
16925 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), 17216 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16926 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), 17217 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16927 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), 17218 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
@@ -17205,6 +17496,36 @@ static struct alc_config_preset alc662_presets[] = {
17205 .setup = alc663_mode6_setup, 17496 .setup = alc663_mode6_setup,
17206 .init_hook = alc663_mode6_inithook, 17497 .init_hook = alc663_mode6_inithook,
17207 }, 17498 },
17499 [ALC663_ASUS_MODE7] = {
17500 .mixers = { alc663_mode7_mixer },
17501 .cap_mixer = alc662_auto_capture_mixer,
17502 .init_verbs = { alc662_init_verbs,
17503 alc663_mode7_init_verbs },
17504 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17505 .hp_nid = 0x03,
17506 .dac_nids = alc662_dac_nids,
17507 .dig_out_nid = ALC662_DIGOUT_NID,
17508 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17509 .channel_mode = alc662_3ST_2ch_modes,
17510 .unsol_event = alc663_mode7_unsol_event,
17511 .setup = alc663_mode7_setup,
17512 .init_hook = alc663_mode7_inithook,
17513 },
17514 [ALC663_ASUS_MODE8] = {
17515 .mixers = { alc663_mode8_mixer },
17516 .cap_mixer = alc662_auto_capture_mixer,
17517 .init_verbs = { alc662_init_verbs,
17518 alc663_mode8_init_verbs },
17519 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17520 .hp_nid = 0x03,
17521 .dac_nids = alc662_dac_nids,
17522 .dig_out_nid = ALC662_DIGOUT_NID,
17523 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17524 .channel_mode = alc662_3ST_2ch_modes,
17525 .unsol_event = alc663_mode8_unsol_event,
17526 .setup = alc663_mode8_setup,
17527 .init_hook = alc663_mode8_inithook,
17528 },
17208 [ALC272_DELL] = { 17529 [ALC272_DELL] = {
17209 .mixers = { alc663_m51va_mixer }, 17530 .mixers = { alc663_m51va_mixer },
17210 .cap_mixer = alc272_auto_capture_mixer, 17531 .cap_mixer = alc272_auto_capture_mixer,
@@ -17688,7 +18009,9 @@ static struct hda_codec_preset snd_hda_preset_realtek[] = {
17688 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, 18009 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17689 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, 18010 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17690 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, 18011 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18012 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
17691 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, 18013 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18014 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
17692 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", 18015 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17693 .patch = patch_alc861 }, 18016 .patch = patch_alc861 },
17694 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, 18017 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },