diff options
-rw-r--r-- | Documentation/sound/alsa/HD-Audio-Models.txt | 1 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 136 |
2 files changed, 137 insertions, 0 deletions
diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt index 0c7ebef62893..5efacf01d9e3 100644 --- a/Documentation/sound/alsa/HD-Audio-Models.txt +++ b/Documentation/sound/alsa/HD-Audio-Models.txt | |||
@@ -124,6 +124,7 @@ ALC882/883/885/888/889 | |||
124 | asus-a7m ASUS A7M | 124 | asus-a7m ASUS A7M |
125 | macpro MacPro support | 125 | macpro MacPro support |
126 | mb5 Macbook 5,1 | 126 | mb5 Macbook 5,1 |
127 | macmini3 Macmini 3,1 | ||
127 | mbp3 Macbook Pro rev3 | 128 | mbp3 Macbook Pro rev3 |
128 | imac24 iMac 24'' with jack detection | 129 | imac24 iMac 24'' with jack detection |
129 | imac91 iMac 9,1 | 130 | imac91 iMac 9,1 |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 0c224977c8cf..b5a6ba025930 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -211,6 +211,7 @@ enum { | |||
211 | ALC885_MACPRO, | 211 | ALC885_MACPRO, |
212 | ALC885_MBP3, | 212 | ALC885_MBP3, |
213 | ALC885_MB5, | 213 | ALC885_MB5, |
214 | ALC885_MACMINI3, | ||
214 | ALC885_IMAC24, | 215 | ALC885_IMAC24, |
215 | ALC885_IMAC91, | 216 | ALC885_IMAC91, |
216 | ALC883_3ST_2ch_DIG, | 217 | ALC883_3ST_2ch_DIG, |
@@ -6751,6 +6752,14 @@ static struct hda_input_mux mb5_capture_source = { | |||
6751 | }, | 6752 | }, |
6752 | }; | 6753 | }; |
6753 | 6754 | ||
6755 | static struct hda_input_mux macmini3_capture_source = { | ||
6756 | .num_items = 2, | ||
6757 | .items = { | ||
6758 | { "Line", 0x2 }, | ||
6759 | { "CD", 0x4 }, | ||
6760 | }, | ||
6761 | }; | ||
6762 | |||
6754 | static struct hda_input_mux alc883_3stack_6ch_intel = { | 6763 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
6755 | .num_items = 4, | 6764 | .num_items = 4, |
6756 | .items = { | 6765 | .items = { |
@@ -6999,6 +7008,35 @@ static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { | |||
6999 | { 6, alc885_mb5_ch6_init }, | 7008 | { 6, alc885_mb5_ch6_init }, |
7000 | }; | 7009 | }; |
7001 | 7010 | ||
7011 | /* | ||
7012 | * 2ch | ||
7013 | * Speakers/Woofer/HP = Front | ||
7014 | * LineIn = Input | ||
7015 | */ | ||
7016 | static struct hda_verb alc885_macmini3_ch2_init[] = { | ||
7017 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
7018 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
7019 | { } /* end */ | ||
7020 | }; | ||
7021 | |||
7022 | /* | ||
7023 | * 6ch mode | ||
7024 | * Speakers/HP = Front | ||
7025 | * Woofer = LFE | ||
7026 | * LineIn = Surround | ||
7027 | */ | ||
7028 | static struct hda_verb alc885_macmini3_ch6_init[] = { | ||
7029 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
7030 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
7031 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
7032 | { } /* end */ | ||
7033 | }; | ||
7034 | |||
7035 | static struct hda_channel_mode alc885_macmini3_6ch_modes[2] = { | ||
7036 | { 2, alc885_mb5_ch2_init }, | ||
7037 | { 6, alc885_mb5_ch6_init }, | ||
7038 | }; | ||
7039 | |||
7002 | 7040 | ||
7003 | /* | 7041 | /* |
7004 | * 2ch mode | 7042 | * 2ch mode |
@@ -7243,6 +7281,21 @@ static struct snd_kcontrol_new alc885_mb5_mixer[] = { | |||
7243 | { } /* end */ | 7281 | { } /* end */ |
7244 | }; | 7282 | }; |
7245 | 7283 | ||
7284 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { | ||
7285 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | ||
7286 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | ||
7287 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | ||
7288 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), | ||
7289 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), | ||
7290 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), | ||
7291 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), | ||
7292 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), | ||
7293 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), | ||
7294 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), | ||
7295 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), | ||
7296 | { } /* end */ | ||
7297 | }; | ||
7298 | |||
7246 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { | 7299 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
7247 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | 7300 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
7248 | HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT), | 7301 | HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT), |
@@ -7617,6 +7670,53 @@ static struct hda_verb alc885_mb5_init_verbs[] = { | |||
7617 | { } | 7670 | { } |
7618 | }; | 7671 | }; |
7619 | 7672 | ||
7673 | /* Macmini 3,1 */ | ||
7674 | static struct hda_verb alc885_macmini3_init_verbs[] = { | ||
7675 | /* DACs */ | ||
7676 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
7677 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
7678 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
7679 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
7680 | /* Front mixer */ | ||
7681 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
7682 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7683 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
7684 | /* Surround mixer */ | ||
7685 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
7686 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7687 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
7688 | /* LFE mixer */ | ||
7689 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
7690 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7691 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
7692 | /* HP mixer */ | ||
7693 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
7694 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7695 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
7696 | /* Front Pin (0x0c) */ | ||
7697 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | ||
7698 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
7699 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7700 | /* LFE Pin (0x0e) */ | ||
7701 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | ||
7702 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
7703 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
7704 | /* HP Pin (0x0f) */ | ||
7705 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
7706 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
7707 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, | ||
7708 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
7709 | /* Line In pin */ | ||
7710 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
7711 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
7712 | |||
7713 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
7714 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
7715 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
7716 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
7717 | { } | ||
7718 | }; | ||
7719 | |||
7620 | /* Macbook Pro rev3 */ | 7720 | /* Macbook Pro rev3 */ |
7621 | static struct hda_verb alc885_mbp3_init_verbs[] = { | 7721 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
7622 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | 7722 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
@@ -7800,6 +7900,18 @@ static void alc885_mb5_automute(struct hda_codec *codec) | |||
7800 | 7900 | ||
7801 | } | 7901 | } |
7802 | 7902 | ||
7903 | static void alc885_macmini3_automute(struct hda_codec *codec) | ||
7904 | { | ||
7905 | unsigned int present; | ||
7906 | |||
7907 | present = snd_hda_codec_read(codec, 0x14, 0, | ||
7908 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
7909 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, | ||
7910 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
7911 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, | ||
7912 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
7913 | } | ||
7914 | |||
7803 | static void alc885_mb5_unsol_event(struct hda_codec *codec, | 7915 | static void alc885_mb5_unsol_event(struct hda_codec *codec, |
7804 | unsigned int res) | 7916 | unsigned int res) |
7805 | { | 7917 | { |
@@ -7808,6 +7920,14 @@ static void alc885_mb5_unsol_event(struct hda_codec *codec, | |||
7808 | alc885_mb5_automute(codec); | 7920 | alc885_mb5_automute(codec); |
7809 | } | 7921 | } |
7810 | 7922 | ||
7923 | static void alc885_macmini3_unsol_event(struct hda_codec *codec, | ||
7924 | unsigned int res) | ||
7925 | { | ||
7926 | /* Headphone insertion or removal. */ | ||
7927 | if ((res >> 26) == ALC880_HP_EVENT) | ||
7928 | alc885_mb5_automute(codec); | ||
7929 | } | ||
7930 | |||
7811 | static void alc885_imac91_automute(struct hda_codec *codec) | 7931 | static void alc885_imac91_automute(struct hda_codec *codec) |
7812 | { | 7932 | { |
7813 | unsigned int present; | 7933 | unsigned int present; |
@@ -8974,6 +9094,7 @@ static const char *alc882_models[ALC882_MODEL_LAST] = { | |||
8974 | [ALC882_ASUS_A7M] = "asus-a7m", | 9094 | [ALC882_ASUS_A7M] = "asus-a7m", |
8975 | [ALC885_MACPRO] = "macpro", | 9095 | [ALC885_MACPRO] = "macpro", |
8976 | [ALC885_MB5] = "mb5", | 9096 | [ALC885_MB5] = "mb5", |
9097 | [ALC885_MACMINI3] = "macmini3", | ||
8977 | [ALC885_MBP3] = "mbp3", | 9098 | [ALC885_MBP3] = "mbp3", |
8978 | [ALC885_IMAC24] = "imac24", | 9099 | [ALC885_IMAC24] = "imac24", |
8979 | [ALC885_IMAC91] = "imac91", | 9100 | [ALC885_IMAC91] = "imac91", |
@@ -9157,6 +9278,7 @@ static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { | |||
9157 | */ | 9278 | */ |
9158 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), | 9279 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
9159 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), | 9280 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
9281 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), | ||
9160 | {} /* terminator */ | 9282 | {} /* terminator */ |
9161 | }; | 9283 | }; |
9162 | 9284 | ||
@@ -9238,6 +9360,20 @@ static struct alc_config_preset alc882_presets[] = { | |||
9238 | .unsol_event = alc885_mb5_unsol_event, | 9360 | .unsol_event = alc885_mb5_unsol_event, |
9239 | .init_hook = alc885_mb5_automute, | 9361 | .init_hook = alc885_mb5_automute, |
9240 | }, | 9362 | }, |
9363 | [ALC885_MACMINI3] = { | ||
9364 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, | ||
9365 | .init_verbs = { alc885_macmini3_init_verbs, | ||
9366 | alc880_gpio1_init_verbs }, | ||
9367 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
9368 | .dac_nids = alc882_dac_nids, | ||
9369 | .channel_mode = alc885_macmini3_6ch_modes, | ||
9370 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), | ||
9371 | .input_mux = &macmini3_capture_source, | ||
9372 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
9373 | .dig_in_nid = ALC882_DIGIN_NID, | ||
9374 | .unsol_event = alc885_macmini3_unsol_event, | ||
9375 | .init_hook = alc885_macmini3_automute, | ||
9376 | }, | ||
9241 | [ALC885_MACPRO] = { | 9377 | [ALC885_MACPRO] = { |
9242 | .mixers = { alc882_macpro_mixer }, | 9378 | .mixers = { alc882_macpro_mixer }, |
9243 | .init_verbs = { alc882_macpro_init_verbs }, | 9379 | .init_verbs = { alc882_macpro_init_verbs }, |