aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda
diff options
context:
space:
mode:
authorKailang Yang <kailang@realtek.com.tw>2007-10-16 08:28:03 -0400
committerJaroslav Kysela <perex@perex.cz>2007-10-16 10:51:24 -0400
commit291702f017efdfe556cb87b8530eb7d1ff08cbae (patch)
treef67834e49f077ee1512f8673056bda59db874fe5 /sound/pci/hda
parentf6e9852ad05fa28301c83d4e2b082620de010358 (diff)
[ALSA] Support ASUS P701 eeepc [0x1043 0x82a1] support
Signed-off-by: Kailang Yang <kailang@realtek.com.tw> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r--sound/pci/hda/patch_realtek.c100
1 files changed, 94 insertions, 6 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 1d2cd4c4b160..c8ca97b2c31d 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -143,6 +143,7 @@ enum {
143 ALC662_3ST_6ch, 143 ALC662_3ST_6ch,
144 ALC662_5ST_DIG, 144 ALC662_5ST_DIG,
145 ALC662_LENOVO_101E, 145 ALC662_LENOVO_101E,
146 ALC662_ASUS_EEEPC_P701,
146 ALC662_AUTO, 147 ALC662_AUTO,
147 ALC662_MODEL_LAST, 148 ALC662_MODEL_LAST,
148}; 149};
@@ -11432,6 +11433,15 @@ static struct hda_input_mux alc662_lenovo_101e_capture_source = {
11432 { "Line", 0x2 }, 11433 { "Line", 0x2 },
11433 }, 11434 },
11434}; 11435};
11436
11437static struct hda_input_mux alc662_eeepc_capture_source = {
11438 .num_items = 2,
11439 .items = {
11440 { "i-Mic", 0x1 },
11441 { "e-Mic", 0x0 },
11442 },
11443};
11444
11435#define alc662_mux_enum_info alc_mux_enum_info 11445#define alc662_mux_enum_info alc_mux_enum_info
11436#define alc662_mux_enum_get alc_mux_enum_get 11446#define alc662_mux_enum_get alc_mux_enum_get
11437 11447
@@ -11648,6 +11658,22 @@ static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
11648 { } /* end */ 11658 { } /* end */
11649}; 11659};
11650 11660
11661static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
11662 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11663
11664 HDA_CODEC_VOLUME("LineOut Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11665 HDA_CODEC_MUTE("LineOut Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11666
11667 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
11668 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11669 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11670
11671 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
11672 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11673 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11674 { } /* end */
11675};
11676
11651static struct snd_kcontrol_new alc662_chmode_mixer[] = { 11677static struct snd_kcontrol_new alc662_chmode_mixer[] = {
11652 { 11678 {
11653 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 11679 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -11713,13 +11739,24 @@ static struct hda_verb alc662_init_verbs[] = {
11713 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 11739 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11714 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 11740 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11715 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, 11741 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
11742
11743 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11744 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11745 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11746 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
11716 { } 11747 { }
11717}; 11748};
11718 11749
11719static struct hda_verb alc662_sue_init_verbs[] = { 11750static struct hda_verb alc662_sue_init_verbs[] = {
11720 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, 11751 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
11721 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, 11752 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
11722 {} 11753 {}
11754};
11755
11756static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
11757 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11758 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11759 {}
11723}; 11760};
11724 11761
11725/* 11762/*
@@ -11825,6 +11862,39 @@ static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
11825 alc662_lenovo_101e_ispeaker_automute(codec); 11862 alc662_lenovo_101e_ispeaker_automute(codec);
11826} 11863}
11827 11864
11865static void alc662_eeepc_mic_automute(struct hda_codec *codec)
11866{
11867 unsigned int present;
11868
11869 present = snd_hda_codec_read(codec, 0x18, 0,
11870 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11871 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11872 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
11873 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11874 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
11875 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11876 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
11877 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11878 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
11879}
11880
11881/* unsolicited event for HP jack sensing */
11882static void alc662_eeepc_unsol_event(struct hda_codec *codec,
11883 unsigned int res)
11884{
11885 if ((res >> 26) == ALC880_HP_EVENT)
11886 alc262_hippo1_automute( codec );
11887
11888 if ((res >> 26) == ALC880_MIC_EVENT)
11889 alc662_eeepc_mic_automute(codec);
11890}
11891
11892static void alc662_eeepc_inithook(struct hda_codec *codec)
11893{
11894 alc262_hippo1_automute( codec );
11895 alc662_eeepc_mic_automute(codec);
11896}
11897
11828#ifdef CONFIG_SND_HDA_POWER_SAVE 11898#ifdef CONFIG_SND_HDA_POWER_SAVE
11829#define alc662_loopbacks alc880_loopbacks 11899#define alc662_loopbacks alc880_loopbacks
11830#endif 11900#endif
@@ -11850,12 +11920,13 @@ static const char *alc662_models[ALC662_MODEL_LAST] = {
11850 11920
11851static struct snd_pci_quirk alc662_cfg_tbl[] = { 11921static struct snd_pci_quirk alc662_cfg_tbl[] = {
11852 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), 11922 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
11923 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
11853 {} 11924 {}
11854}; 11925};
11855 11926
11856static struct alc_config_preset alc662_presets[] = { 11927static struct alc_config_preset alc662_presets[] = {
11857 [ALC662_3ST_2ch_DIG] = { 11928 [ALC662_3ST_2ch_DIG] = {
11858 .mixers = { alc662_3ST_2ch_mixer }, 11929 .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer },
11859 .init_verbs = { alc662_init_verbs }, 11930 .init_verbs = { alc662_init_verbs },
11860 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 11931 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11861 .dac_nids = alc662_dac_nids, 11932 .dac_nids = alc662_dac_nids,
@@ -11868,7 +11939,8 @@ static struct alc_config_preset alc662_presets[] = {
11868 .input_mux = &alc662_capture_source, 11939 .input_mux = &alc662_capture_source,
11869 }, 11940 },
11870 [ALC662_3ST_6ch_DIG] = { 11941 [ALC662_3ST_6ch_DIG] = {
11871 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, 11942 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
11943 alc662_capture_mixer },
11872 .init_verbs = { alc662_init_verbs }, 11944 .init_verbs = { alc662_init_verbs },
11873 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 11945 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11874 .dac_nids = alc662_dac_nids, 11946 .dac_nids = alc662_dac_nids,
@@ -11882,7 +11954,8 @@ static struct alc_config_preset alc662_presets[] = {
11882 .input_mux = &alc662_capture_source, 11954 .input_mux = &alc662_capture_source,
11883 }, 11955 },
11884 [ALC662_3ST_6ch] = { 11956 [ALC662_3ST_6ch] = {
11885 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, 11957 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
11958 alc662_capture_mixer },
11886 .init_verbs = { alc662_init_verbs }, 11959 .init_verbs = { alc662_init_verbs },
11887 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 11960 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11888 .dac_nids = alc662_dac_nids, 11961 .dac_nids = alc662_dac_nids,
@@ -11894,7 +11967,8 @@ static struct alc_config_preset alc662_presets[] = {
11894 .input_mux = &alc662_capture_source, 11967 .input_mux = &alc662_capture_source,
11895 }, 11968 },
11896 [ALC662_5ST_DIG] = { 11969 [ALC662_5ST_DIG] = {
11897 .mixers = { alc662_base_mixer, alc662_chmode_mixer }, 11970 .mixers = { alc662_base_mixer, alc662_chmode_mixer,
11971 alc662_capture_mixer },
11898 .init_verbs = { alc662_init_verbs }, 11972 .init_verbs = { alc662_init_verbs },
11899 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 11973 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11900 .dac_nids = alc662_dac_nids, 11974 .dac_nids = alc662_dac_nids,
@@ -11907,7 +11981,7 @@ static struct alc_config_preset alc662_presets[] = {
11907 .input_mux = &alc662_capture_source, 11981 .input_mux = &alc662_capture_source,
11908 }, 11982 },
11909 [ALC662_LENOVO_101E] = { 11983 [ALC662_LENOVO_101E] = {
11910 .mixers = { alc662_lenovo_101e_mixer }, 11984 .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer },
11911 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, 11985 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
11912 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 11986 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11913 .dac_nids = alc662_dac_nids, 11987 .dac_nids = alc662_dac_nids,
@@ -11919,6 +11993,20 @@ static struct alc_config_preset alc662_presets[] = {
11919 .unsol_event = alc662_lenovo_101e_unsol_event, 11993 .unsol_event = alc662_lenovo_101e_unsol_event,
11920 .init_hook = alc662_lenovo_101e_all_automute, 11994 .init_hook = alc662_lenovo_101e_all_automute,
11921 }, 11995 },
11996 [ALC662_ASUS_EEEPC_P701] = {
11997 .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer },
11998 .init_verbs = { alc662_init_verbs,
11999 alc662_eeepc_sue_init_verbs },
12000 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
12001 .dac_nids = alc662_dac_nids,
12002 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12003 .adc_nids = alc662_adc_nids,
12004 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
12005 .channel_mode = alc662_3ST_2ch_modes,
12006 .input_mux = &alc662_eeepc_capture_source,
12007 .unsol_event = alc662_eeepc_unsol_event,
12008 .init_hook = alc662_eeepc_inithook,
12009 },
11922 12010
11923}; 12011};
11924 12012