aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-08-16 12:19:38 -0400
committerJaroslav Kysela <perex@perex.cz>2007-10-16 09:59:11 -0400
commit87350ad0cf05d734309ca40e1524a07cf12190aa (patch)
tree1b4ebe80fcd721551b23024e189ea39b75d6b5ae /sound/pci
parent38baf5ad8b7d24be16a2cf0e4c1d7429aeb4aa45 (diff)
[ALSA] hda-codec - Add support for Macbook Pro rev3
Added the support for Macbook Pro rev3 with ALC885 codec chip. The patch taken from ALSA bug#3242. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/patch_realtek.c145
1 files changed, 145 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index e4064f997e8c..0473f2a9c182 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -156,6 +156,7 @@ enum {
156 ALC882_TARGA, 156 ALC882_TARGA,
157 ALC882_ASUS_A7J, 157 ALC882_ASUS_A7J,
158 ALC885_MACPRO, 158 ALC885_MACPRO,
159 ALC885_MBP3,
159 ALC885_IMAC24, 160 ALC885_IMAC24,
160 ALC882_AUTO, 161 ALC882_AUTO,
161 ALC882_MODEL_LAST, 162 ALC882_MODEL_LAST,
@@ -4895,6 +4896,38 @@ static struct hda_channel_mode alc882_sixstack_modes[2] = {
4895 { 8, alc882_sixstack_ch8_init }, 4896 { 8, alc882_sixstack_ch8_init },
4896}; 4897};
4897 4898
4899/*
4900 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
4901 */
4902
4903/*
4904 * 2ch mode
4905 */
4906static struct hda_verb alc885_mbp_ch2_init[] = {
4907 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
4908 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4909 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4910 { } /* end */
4911};
4912
4913/*
4914 * 6ch mode
4915 */
4916static struct hda_verb alc885_mbp_ch6_init[] = {
4917 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4918 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4919 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
4920 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4921 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4922 { } /* end */
4923};
4924
4925static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
4926 { 2, alc885_mbp_ch2_init },
4927 { 6, alc885_mbp_ch6_init },
4928};
4929
4930
4898/* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 4931/* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
4899 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b 4932 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
4900 */ 4933 */
@@ -4925,6 +4958,19 @@ static struct snd_kcontrol_new alc882_base_mixer[] = {
4925 { } /* end */ 4958 { } /* end */
4926}; 4959};
4927 4960
4961static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
4962 HDA_CODEC_VOLUME("Master Volume", 0x0c, 0x00, HDA_OUTPUT),
4963 HDA_BIND_MUTE ("Master Switch", 0x0c, 0x02, HDA_INPUT),
4964 HDA_CODEC_MUTE ("Speaker Switch", 0x14, 0x00, HDA_OUTPUT),
4965 HDA_CODEC_VOLUME("Line Out Volume", 0x0d,0x00, HDA_OUTPUT),
4966 HDA_CODEC_VOLUME("Line In Playback Volume", 0x0b, 0x02, HDA_INPUT),
4967 HDA_CODEC_MUTE ("Line In Playback Switch", 0x0b, 0x02, HDA_INPUT),
4968 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
4969 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
4970 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0x00, HDA_INPUT),
4971 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
4972 { } /* end */
4973};
4928static struct snd_kcontrol_new alc882_w2jc_mixer[] = { 4974static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
4929 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 4975 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4930 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 4976 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
@@ -5135,6 +5181,66 @@ static struct hda_verb alc882_macpro_init_verbs[] = {
5135 { } 5181 { }
5136}; 5182};
5137 5183
5184/* Macbook Pro rev3 */
5185static struct hda_verb alc885_mbp3_init_verbs[] = {
5186 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5187 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5188 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5189 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5190 /* Rear mixer */
5191 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5192 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5193 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5194 /* Front Pin: output 0 (0x0c) */
5195 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5196 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5197 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5198 /* HP Pin: output 0 (0x0d) */
5199 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
5200 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5201 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5202 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5203 /* Mic (rear) pin: input vref at 80% */
5204 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5205 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5206 /* Front Mic pin: input vref at 80% */
5207 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5208 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5209 /* Line In pin: use output 1 when in LineOut mode */
5210 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5211 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5212 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
5213
5214 /* FIXME: use matrix-type input source selection */
5215 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5216 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5217 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5218 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5219 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5220 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5221 /* Input mixer2 */
5222 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5223 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5224 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5225 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5226 /* Input mixer3 */
5227 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5228 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5229 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5230 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5231 /* ADC1: mute amp left and right */
5232 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5233 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5234 /* ADC2: mute amp left and right */
5235 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5236 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5237 /* ADC3: mute amp left and right */
5238 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5239 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5240
5241 { }
5242};
5243
5138/* iMac 24 mixer. */ 5244/* iMac 24 mixer. */
5139static struct snd_kcontrol_new alc885_imac24_mixer[] = { 5245static struct snd_kcontrol_new alc885_imac24_mixer[] = {
5140 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), 5246 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
@@ -5185,6 +5291,27 @@ static void alc885_imac24_unsol_event(struct hda_codec *codec,
5185 alc885_imac24_automute(codec); 5291 alc885_imac24_automute(codec);
5186} 5292}
5187 5293
5294static void alc885_mbp3_automute(struct hda_codec *codec)
5295{
5296 unsigned int present;
5297
5298 present = snd_hda_codec_read(codec, 0x15, 0,
5299 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5300 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
5301 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5302 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
5303 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
5304
5305}
5306static void alc885_mbp3_unsol_event(struct hda_codec *codec,
5307 unsigned int res)
5308{
5309 /* Headphone insertion or removal. */
5310 if ((res >> 26) == ALC880_HP_EVENT)
5311 alc885_mbp3_automute(codec);
5312}
5313
5314
5188static struct hda_verb alc882_targa_verbs[] = { 5315static struct hda_verb alc882_targa_verbs[] = {
5189 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5316 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5190 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5317 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
@@ -5422,6 +5549,7 @@ static const char *alc882_models[ALC882_MODEL_LAST] = {
5422 [ALC882_ARIMA] = "arima", 5549 [ALC882_ARIMA] = "arima",
5423 [ALC882_W2JC] = "w2jc", 5550 [ALC882_W2JC] = "w2jc",
5424 [ALC885_MACPRO] = "macpro", 5551 [ALC885_MACPRO] = "macpro",
5552 [ALC885_MBP3] = "mbp3",
5425 [ALC885_IMAC24] = "imac24", 5553 [ALC885_IMAC24] = "imac24",
5426 [ALC882_AUTO] = "auto", 5554 [ALC882_AUTO] = "auto",
5427}; 5555};
@@ -5484,6 +5612,20 @@ static struct alc_config_preset alc882_presets[] = {
5484 .input_mux = &alc882_capture_source, 5612 .input_mux = &alc882_capture_source,
5485 .dig_out_nid = ALC882_DIGOUT_NID, 5613 .dig_out_nid = ALC882_DIGOUT_NID,
5486 }, 5614 },
5615 [ALC885_MBP3] = {
5616 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
5617 .init_verbs = { alc885_mbp3_init_verbs,
5618 alc880_gpio1_init_verbs },
5619 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5620 .dac_nids = alc882_dac_nids,
5621 .channel_mode = alc885_mbp_6ch_modes,
5622 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
5623 .input_mux = &alc882_capture_source,
5624 .dig_out_nid = ALC882_DIGOUT_NID,
5625 .dig_in_nid = ALC882_DIGIN_NID,
5626 .unsol_event = alc885_mbp3_unsol_event,
5627 .init_hook = alc885_mbp3_automute,
5628 },
5487 [ALC885_MACPRO] = { 5629 [ALC885_MACPRO] = {
5488 .mixers = { alc882_macpro_mixer }, 5630 .mixers = { alc882_macpro_mixer },
5489 .init_verbs = { alc882_macpro_init_verbs }, 5631 .init_verbs = { alc882_macpro_init_verbs },
@@ -5684,6 +5826,9 @@ static int patch_alc882(struct hda_codec *codec)
5684 case 0x106b1000: /* iMac 24 */ 5826 case 0x106b1000: /* iMac 24 */
5685 board_config = ALC885_IMAC24; 5827 board_config = ALC885_IMAC24;
5686 break; 5828 break;
5829 case 0x106b2c00: /* Macbook Pro rev3 */
5830 board_config = ALC885_MBP3;
5831 break;
5687 default: 5832 default:
5688 printk(KERN_INFO "hda_codec: Unknown model for ALC882, " 5833 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
5689 "trying auto-probe from BIOS...\n"); 5834 "trying auto-probe from BIOS...\n");