aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorAlex Murray <murray.alex@gmail.com>2010-01-13 07:45:03 -0500
committerTakashi Iwai <tiwai@suse.de>2010-01-13 12:58:38 -0500
commita76221d47ef2b73ff16c0fef00a784026308ea02 (patch)
tree67a19ad10470db8257b7003bcd927318b97d6a36 /sound
parent4dee8baa18d611b6dc854e1cc193550ff6f687be (diff)
ALSA: hda - Improved MacBook (Pro) 5,1 / 5,2 support
This patch adds support for automatically muting the speakers when headphones are inserted, as well as relabelling the headphone widgets from the non-standard "HP" to the standard "Headphone" for the mb5 model. Signed-off-by: Alex Murray <murray.alex@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_realtek.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index bff60cea7777..11b989bacd3c 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -7094,8 +7094,8 @@ static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7094 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), 7094 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7095 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), 7095 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7096 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), 7096 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7097 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT), 7097 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7098 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT), 7098 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7099 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 7099 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7100 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 7100 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7101 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), 7101 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
@@ -7496,6 +7496,7 @@ static struct hda_verb alc885_mb5_init_verbs[] = {
7496 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 7496 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7497 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7497 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7498 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, 7498 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7499 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7499 /* Front Mic pin: input vref at 80% */ 7500 /* Front Mic pin: input vref at 80% */
7500 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 7501 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7501 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 7502 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
@@ -7680,6 +7681,27 @@ static void alc885_mbp3_setup(struct hda_codec *codec)
7680 spec->autocfg.speaker_pins[0] = 0x14; 7681 spec->autocfg.speaker_pins[0] = 0x14;
7681} 7682}
7682 7683
7684static void alc885_mb5_automute(struct hda_codec *codec)
7685{
7686 unsigned int present;
7687
7688 present = snd_hda_codec_read(codec, 0x14, 0,
7689 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7690 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
7691 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7692 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7693 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7694
7695}
7696
7697static void alc885_mb5_unsol_event(struct hda_codec *codec,
7698 unsigned int res)
7699{
7700 /* Headphone insertion or removal. */
7701 if ((res >> 26) == ALC880_HP_EVENT)
7702 alc885_mb5_automute(codec);
7703}
7704
7683static void alc885_imac91_automute(struct hda_codec *codec) 7705static void alc885_imac91_automute(struct hda_codec *codec)
7684{ 7706{
7685 unsigned int present; 7707 unsigned int present;
@@ -9126,6 +9148,8 @@ static struct alc_config_preset alc882_presets[] = {
9126 .input_mux = &mb5_capture_source, 9148 .input_mux = &mb5_capture_source,
9127 .dig_out_nid = ALC882_DIGOUT_NID, 9149 .dig_out_nid = ALC882_DIGOUT_NID,
9128 .dig_in_nid = ALC882_DIGIN_NID, 9150 .dig_in_nid = ALC882_DIGIN_NID,
9151 .unsol_event = alc885_mb5_unsol_event,
9152 .init_hook = alc885_mb5_automute,
9129 }, 9153 },
9130 [ALC885_MACPRO] = { 9154 [ALC885_MACPRO] = {
9131 .mixers = { alc882_macpro_mixer }, 9155 .mixers = { alc882_macpro_mixer },