aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorJustin P. Mattock <justinmattock@gmail.com>2010-05-23 13:55:00 -0400
committerTakashi Iwai <tiwai@suse.de>2010-05-25 02:44:59 -0400
commitb7cccc52feb142f48beae1566b749480fa9989de (patch)
treed0c1336e4cc8bdc558fb5c457febecae696f92d8 /sound
parent4e0938dba7fccf37a4aecba4d937da7f312b5d55 (diff)
ALSA: hda - iMac9,1 sound fixes
First issue: With the original patch, I've noticed by unmuting the mic (and even having it muted), there is a distorted("Noise") coming from the internal speakers, even when the headphones are plugged in. What my finding's revealed is: /* Mic (rear) pin: input vref at 80% */ {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, From the original patch. Looking at codec#0 0x18/0x1a is listed as: Node 0x18 [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-In vals: [0x00 0x00] Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x0000373c: IN OUT HP Detect Vref caps: HIZ 50 GRD 80 100 Pin Default 0x90100141: [Fixed] Speaker at Int N/A Conn = Unknown, Color = Unknown DefAssociation = 0x4, Sequence = 0x1 Misc = NO_PRESENCE Pin-ctls: 0x41: OUT VREF_50 Unsolicited: tag=00, enabled=0 Connection: 5 0x0c* 0x0d 0x0e 0x0f 0x26 seems this Node is listed as: [Fixed] Speaker while 0x15 Node 0x15 [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-In vals: [0x00 0x00] Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x80 0x80] Pincap 0x0000373c: IN OUT HP Detect Vref caps: HIZ 50 GRD 80 100 Pin Default 0x018b3020: [Jack] Line In at Ext Rear Conn = Comb, Color = Blue DefAssociation = 0x2, Sequence = 0x0 Pin-ctls: 0x01: VREF_50 Unsolicited: tag=00, enabled=0 Connection: 5 0x0c 0x0d* 0x0e 0x0f 0x26 is [Jack] Line In at Ext Rear. (looking at the other apple products as examples I came up with the fix below). Second issue: alc885_mbp_4ch_modes The original patch does a good job with the HP pin automute function, but from what I noticed is I would have to manually change the channel form 2 to 4 after plugging the headphones in. And not to mention having odd moments to where I was jamming out with the headphones on, then later realized I had sound blasting out of the speakers as well. My findings revealed that changing alc885_mbp_4ch_modes to alc885_mba21_ch_modes and setting - spec->autocfg.speaker_pins[0] = 0x15; + spec->autocfg.speaker_pins[0] = 0x18; gets the automute function when the headphones plugged in working flawlessly(and the no need to manually change the channel number afterwards). Third issue: alc885_imac91_mixer There probably doesnt need to be anything changed with this (esspecially if your one to like lots of sliders),but my findings revealed that mac osx only has a master on the top right, another switch on itunes, and then a slider for the mic. So the changes I did below try and mimic osx as much as possible (only thing I had an issue with is just having one mute switch on the master, instead of having two(still investigating)). fourth issue: alc882_capture_source I endeded up creating alc889A_imac91_capture_source() only because looking at alc882_capture_source I see that the mic is set to 0x1 while this works, I also noticed that adding 0x1 and 0x01 and testing that 0x1 somehow stops working, and 0x01 works(so I figured 0x01 was more of the alpha of the numbers(still need to figure out where that valuse is)). In any case the microphone does work with the original, and with the below patch, but both still record not as clean(lots of "Noise", which I would like to look into too). Note: using alsamixer -Va reveals the capture switches. Signed-off-by: Justin P. Mattock <justinmattock@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_realtek.c84
1 files changed, 40 insertions, 44 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 53538b0f999..17d4548cc35 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -7025,6 +7025,14 @@ static struct hda_input_mux alc889A_mb31_capture_source = {
7025 }, 7025 },
7026}; 7026};
7027 7027
7028static struct hda_input_mux alc889A_imac91_capture_source = {
7029 .num_items = 2,
7030 .items = {
7031 { "Mic", 0x01 },
7032 { "Line", 0x2 }, /* Not sure! */
7033 },
7034};
7035
7028/* 7036/*
7029 * 2ch mode 7037 * 2ch mode
7030 */ 7038 */
@@ -7486,15 +7494,8 @@ static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7486}; 7494};
7487 7495
7488static struct snd_kcontrol_new alc885_imac91_mixer[] = { 7496static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7489 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT), 7497 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7490 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT), 7498 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7491 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7492 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7493 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7494 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7495 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7496 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7497 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7498 { } /* end */ 7499 { } /* end */
7499}; 7500};
7500 7501
@@ -7995,61 +7996,56 @@ static struct hda_verb alc885_mbp3_init_verbs[] = {
7995 7996
7996/* iMac 9,1 */ 7997/* iMac 9,1 */
7997static struct hda_verb alc885_imac91_init_verbs[] = { 7998static struct hda_verb alc885_imac91_init_verbs[] = {
7998 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ 7999 /* Internal Speaker Pin (0x0c) */
7999 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 8000 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8000 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 8001 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8001 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 8002 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8002 /* Rear mixer */ 8003 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8003 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 8004 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8004 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 8005 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8005 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 8006 /* HP Pin: Rear */
8006 /* HP Pin: output 0 (0x0c) */
8007 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 8007 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8008 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 8008 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8009 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, 8009 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8010 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 8010 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8011 /* Internal Speakers: output 0 (0x0d) */ 8011 /* Line in Rear */
8012 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 8012 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8013 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 8013 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8014 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8015 /* Mic (rear) pin: input vref at 80% */
8016 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8017 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8018 /* Front Mic pin: input vref at 80% */ 8014 /* Front Mic pin: input vref at 80% */
8019 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 8015 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8020 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 8016 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8021 /* Line In pin: use output 1 when in LineOut mode */ 8017 /* Rear mixer */
8022 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 8018 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8023 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 8019 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8024 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, 8020 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8025 8021 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8026 /* FIXME: use matrix-type input source selection */ 8022 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8027 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ 8023 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8028 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ 8024 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8025 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8029 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 8026 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8030 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 8027 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8031 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 8028 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8032 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 8029 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8033 /* Input mixer2 */ 8030 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8034 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 8031 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8035 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 8032 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8036 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 8033 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8037 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 8034 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8038 /* Input mixer3 */ 8035 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8039 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 8036 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8040 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 8037 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8041 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 8038 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8042 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 8039 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8043 /* ADC1: mute amp left and right */ 8040 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8044 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 8041 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8045 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, 8042 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8046 /* ADC2: mute amp left and right */ 8043 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8047 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 8044 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8048 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 8045 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8049 /* ADC3: mute amp left and right */ 8046 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8050 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 8047 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8051 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, 8048 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8052
8053 { } 8049 { }
8054}; 8050};
8055 8051
@@ -8118,7 +8114,7 @@ static void alc885_imac91_setup(struct hda_codec *codec)
8118 struct alc_spec *spec = codec->spec; 8114 struct alc_spec *spec = codec->spec;
8119 8115
8120 spec->autocfg.hp_pins[0] = 0x14; 8116 spec->autocfg.hp_pins[0] = 0x14;
8121 spec->autocfg.speaker_pins[0] = 0x15; 8117 spec->autocfg.speaker_pins[0] = 0x18;
8122 spec->autocfg.speaker_pins[1] = 0x1a; 8118 spec->autocfg.speaker_pins[1] = 0x1a;
8123} 8119}
8124 8120
@@ -9627,14 +9623,14 @@ static struct alc_config_preset alc882_presets[] = {
9627 .init_hook = alc885_imac24_init_hook, 9623 .init_hook = alc885_imac24_init_hook,
9628 }, 9624 },
9629 [ALC885_IMAC91] = { 9625 [ALC885_IMAC91] = {
9630 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer }, 9626 .mixers = {alc885_imac91_mixer},
9631 .init_verbs = { alc885_imac91_init_verbs, 9627 .init_verbs = { alc885_imac91_init_verbs,
9632 alc880_gpio1_init_verbs }, 9628 alc880_gpio1_init_verbs },
9633 .num_dacs = ARRAY_SIZE(alc882_dac_nids), 9629 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9634 .dac_nids = alc882_dac_nids, 9630 .dac_nids = alc882_dac_nids,
9635 .channel_mode = alc885_mbp_4ch_modes, 9631 .channel_mode = alc885_mba21_ch_modes,
9636 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), 9632 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9637 .input_mux = &alc882_capture_source, 9633 .input_mux = &alc889A_imac91_capture_source,
9638 .dig_out_nid = ALC882_DIGOUT_NID, 9634 .dig_out_nid = ALC882_DIGOUT_NID,
9639 .dig_in_nid = ALC882_DIGIN_NID, 9635 .dig_in_nid = ALC882_DIGIN_NID,
9640 .unsol_event = alc_automute_amp_unsol_event, 9636 .unsol_event = alc_automute_amp_unsol_event,