aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-08-16 09:23:35 -0400
committerJaroslav Kysela <perex@perex.cz>2007-10-16 09:59:06 -0400
commit676a9b53dcb0843a98f7339a492e42baf4b9a734 (patch)
treec109db66f1ba1843d82df634041f42ba5f219c7c /sound/pci/hda
parent6c726dc672d82749e09345a79350838d4558fae4 (diff)
[ALSA] hda-codec - Add unsol_event to ALC883 Acer Aspire
Added unsol_event handling to ALC883 Acer Aspire codes. Also, removed unneeded channel-mode mixer control from 2-ch only presets. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r--sound/pci/hda/patch_realtek.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 31ff11721b7d..eec1a784386a 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -6575,18 +6575,41 @@ static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
6575 alc883_lenovo_101e_ispeaker_automute(codec); 6575 alc883_lenovo_101e_ispeaker_automute(codec);
6576} 6576}
6577 6577
6578/* toggle speaker-output according to the hp-jack state */
6579static void alc883_acer_aspire_automute(struct hda_codec *codec)
6580{
6581 unsigned int present;
6582
6583 present = snd_hda_codec_read(codec, 0x14, 0,
6584 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6585 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6586 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6587 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
6588 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6589}
6590
6591static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
6592 unsigned int res)
6593{
6594 if ((res >> 26) == ALC880_HP_EVENT)
6595 alc883_acer_aspire_automute(codec);
6596}
6597
6578static struct hda_verb alc883_acer_eapd_verbs[] = { 6598static struct hda_verb alc883_acer_eapd_verbs[] = {
6579 /* HP Pin: output 0 (0x0c) */ 6599 /* HP Pin: output 0 (0x0c) */
6580 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 6600 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6581 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 6601 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6582 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, 6602 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6583 /* Front Pin: output 0 (0x0c) */ 6603 /* Front Pin: output 0 (0x0c) */
6604 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6605 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6584 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 6606 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6585 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6586 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, 6607 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
6587 /* eanable EAPD on medion laptop */ 6608 /* eanable EAPD on medion laptop */
6588 {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, 6609 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6589 {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, 6610 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
6611 /* enable unsolicited event */
6612 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6590 { } 6613 { }
6591}; 6614};
6592 6615
@@ -6832,8 +6855,7 @@ static struct alc_config_preset alc883_presets[] = {
6832 .init_hook = alc883_tagra_automute, 6855 .init_hook = alc883_tagra_automute,
6833 }, 6856 },
6834 [ALC883_ACER] = { 6857 [ALC883_ACER] = {
6835 .mixers = { alc883_base_mixer, 6858 .mixers = { alc883_base_mixer },
6836 alc883_chmode_mixer },
6837 /* On TravelMate laptops, GPIO 0 enables the internal speaker 6859 /* On TravelMate laptops, GPIO 0 enables the internal speaker
6838 * and the headphone jack. Turn this on and rely on the 6860 * and the headphone jack. Turn this on and rely on the
6839 * standard mute methods whenever the user wants to turn 6861 * standard mute methods whenever the user wants to turn
@@ -6849,12 +6871,7 @@ static struct alc_config_preset alc883_presets[] = {
6849 .input_mux = &alc883_capture_source, 6871 .input_mux = &alc883_capture_source,
6850 }, 6872 },
6851 [ALC883_ACER_ASPIRE] = { 6873 [ALC883_ACER_ASPIRE] = {
6852 .mixers = { alc883_acer_aspire_mixer, alc883_chmode_mixer }, 6874 .mixers = { alc883_acer_aspire_mixer },
6853 /* On TravelMate laptops, GPIO 0 enables the internal speaker
6854 * and the headphone jack. Turn this on and rely on the
6855 * standard mute methods whenever the user wants to turn
6856 * these outputs off.
6857 */
6858 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, 6875 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
6859 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 6876 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6860 .dac_nids = alc883_dac_nids, 6877 .dac_nids = alc883_dac_nids,
@@ -6864,6 +6881,8 @@ static struct alc_config_preset alc883_presets[] = {
6864 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 6881 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
6865 .channel_mode = alc883_3ST_2ch_modes, 6882 .channel_mode = alc883_3ST_2ch_modes,
6866 .input_mux = &alc883_capture_source, 6883 .input_mux = &alc883_capture_source,
6884 .unsol_event = alc883_acer_aspire_unsol_event,
6885 .init_hook = alc883_acer_aspire_automute,
6867 }, 6886 },
6868 [ALC883_MEDION] = { 6887 [ALC883_MEDION] = {
6869 .mixers = { alc883_fivestack_mixer, 6888 .mixers = { alc883_fivestack_mixer,
@@ -6893,8 +6912,7 @@ static struct alc_config_preset alc883_presets[] = {
6893 .init_hook = alc883_medion_md2_automute, 6912 .init_hook = alc883_medion_md2_automute,
6894 }, 6913 },
6895 [ALC883_LAPTOP_EAPD] = { 6914 [ALC883_LAPTOP_EAPD] = {
6896 .mixers = { alc883_base_mixer, 6915 .mixers = { alc883_base_mixer },
6897 alc883_chmode_mixer },
6898 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, 6916 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
6899 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 6917 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6900 .dac_nids = alc883_dac_nids, 6918 .dac_nids = alc883_dac_nids,