diff options
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 127 |
1 files changed, 126 insertions, 1 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index db4a7367b625..888b6313eeca 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -208,6 +208,7 @@ enum { | |||
208 | ALC885_MBP3, | 208 | ALC885_MBP3, |
209 | ALC885_MB5, | 209 | ALC885_MB5, |
210 | ALC885_IMAC24, | 210 | ALC885_IMAC24, |
211 | ALC885_IMAC91, | ||
211 | ALC883_3ST_2ch_DIG, | 212 | ALC883_3ST_2ch_DIG, |
212 | ALC883_3ST_6ch_DIG, | 213 | ALC883_3ST_6ch_DIG, |
213 | ALC883_3ST_6ch, | 214 | ALC883_3ST_6ch, |
@@ -2400,6 +2401,8 @@ static const char *alc_slave_sws[] = { | |||
2400 | "Speaker Playback Switch", | 2401 | "Speaker Playback Switch", |
2401 | "Mono Playback Switch", | 2402 | "Mono Playback Switch", |
2402 | "IEC958 Playback Switch", | 2403 | "IEC958 Playback Switch", |
2404 | "Line-Out Playback Switch", | ||
2405 | "PCM Playback Switch", | ||
2403 | NULL, | 2406 | NULL, |
2404 | }; | 2407 | }; |
2405 | 2408 | ||
@@ -7050,6 +7053,20 @@ static struct snd_kcontrol_new alc885_mb5_mixer[] = { | |||
7050 | { } /* end */ | 7053 | { } /* end */ |
7051 | }; | 7054 | }; |
7052 | 7055 | ||
7056 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { | ||
7057 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | ||
7058 | HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT), | ||
7059 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), | ||
7060 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | ||
7061 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
7062 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
7063 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), | ||
7064 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), | ||
7065 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), | ||
7066 | { } /* end */ | ||
7067 | }; | ||
7068 | |||
7069 | |||
7053 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { | 7070 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
7054 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 7071 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
7055 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | 7072 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
@@ -7505,6 +7522,66 @@ static struct hda_verb alc885_mbp3_init_verbs[] = { | |||
7505 | { } | 7522 | { } |
7506 | }; | 7523 | }; |
7507 | 7524 | ||
7525 | /* iMac 9,1 */ | ||
7526 | static struct hda_verb alc885_imac91_init_verbs[] = { | ||
7527 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ | ||
7528 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
7529 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7530 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
7531 | /* Rear mixer */ | ||
7532 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
7533 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7534 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
7535 | /* HP Pin: output 0 (0x0c) */ | ||
7536 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
7537 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
7538 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7539 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
7540 | /* Internal Speakers: output 0 (0x0d) */ | ||
7541 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
7542 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
7543 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7544 | /* Mic (rear) pin: input vref at 80% */ | ||
7545 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
7546 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
7547 | /* Front Mic pin: input vref at 80% */ | ||
7548 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
7549 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
7550 | /* Line In pin: use output 1 when in LineOut mode */ | ||
7551 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
7552 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
7553 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
7554 | |||
7555 | /* FIXME: use matrix-type input source selection */ | ||
7556 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | ||
7557 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
7558 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
7559 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
7560 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
7561 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
7562 | /* Input mixer2 */ | ||
7563 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
7564 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
7565 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
7566 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
7567 | /* Input mixer3 */ | ||
7568 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
7569 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
7570 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
7571 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
7572 | /* ADC1: mute amp left and right */ | ||
7573 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7574 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7575 | /* ADC2: mute amp left and right */ | ||
7576 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7577 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7578 | /* ADC3: mute amp left and right */ | ||
7579 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7580 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7581 | |||
7582 | { } | ||
7583 | }; | ||
7584 | |||
7508 | /* iMac 24 mixer. */ | 7585 | /* iMac 24 mixer. */ |
7509 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { | 7586 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
7510 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | 7587 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
@@ -7551,6 +7628,26 @@ static void alc885_mbp3_setup(struct hda_codec *codec) | |||
7551 | spec->autocfg.speaker_pins[0] = 0x14; | 7628 | spec->autocfg.speaker_pins[0] = 0x14; |
7552 | } | 7629 | } |
7553 | 7630 | ||
7631 | static void alc885_imac91_automute(struct hda_codec *codec) | ||
7632 | { | ||
7633 | unsigned int present; | ||
7634 | |||
7635 | present = snd_hda_codec_read(codec, 0x14, 0, | ||
7636 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
7637 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | ||
7638 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
7639 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, | ||
7640 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
7641 | |||
7642 | } | ||
7643 | |||
7644 | static void alc885_imac91_unsol_event(struct hda_codec *codec, | ||
7645 | unsigned int res) | ||
7646 | { | ||
7647 | /* Headphone insertion or removal. */ | ||
7648 | if ((res >> 26) == ALC880_HP_EVENT) | ||
7649 | alc885_imac91_automute(codec); | ||
7650 | } | ||
7554 | 7651 | ||
7555 | static struct hda_verb alc882_targa_verbs[] = { | 7652 | static struct hda_verb alc882_targa_verbs[] = { |
7556 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 7653 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
@@ -8718,6 +8815,7 @@ static const char *alc882_models[ALC882_MODEL_LAST] = { | |||
8718 | [ALC885_MB5] = "mb5", | 8815 | [ALC885_MB5] = "mb5", |
8719 | [ALC885_MBP3] = "mbp3", | 8816 | [ALC885_MBP3] = "mbp3", |
8720 | [ALC885_IMAC24] = "imac24", | 8817 | [ALC885_IMAC24] = "imac24", |
8818 | [ALC885_IMAC91] = "imac91", | ||
8721 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", | 8819 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
8722 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", | 8820 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
8723 | [ALC883_3ST_6ch] = "3stack-6ch", | 8821 | [ALC883_3ST_6ch] = "3stack-6ch", |
@@ -8891,6 +8989,7 @@ static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { | |||
8891 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), | 8989 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
8892 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), | 8990 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
8893 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), | 8991 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
8992 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), | ||
8894 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), | 8993 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
8895 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, | 8994 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
8896 | * so apparently no perfect solution yet | 8995 | * so apparently no perfect solution yet |
@@ -9002,6 +9101,20 @@ static struct alc_config_preset alc882_presets[] = { | |||
9002 | .setup = alc885_imac24_setup, | 9101 | .setup = alc885_imac24_setup, |
9003 | .init_hook = alc885_imac24_init_hook, | 9102 | .init_hook = alc885_imac24_init_hook, |
9004 | }, | 9103 | }, |
9104 | [ALC885_IMAC91] = { | ||
9105 | .mixers = { alc885_imac91_mixer, alc882_chmode_mixer }, | ||
9106 | .init_verbs = { alc885_imac91_init_verbs, | ||
9107 | alc880_gpio1_init_verbs }, | ||
9108 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
9109 | .dac_nids = alc882_dac_nids, | ||
9110 | .channel_mode = alc885_mbp_4ch_modes, | ||
9111 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), | ||
9112 | .input_mux = &alc882_capture_source, | ||
9113 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
9114 | .dig_in_nid = ALC882_DIGIN_NID, | ||
9115 | .unsol_event = alc885_imac91_unsol_event, | ||
9116 | .init_hook = alc885_imac91_automute, | ||
9117 | }, | ||
9005 | [ALC882_TARGA] = { | 9118 | [ALC882_TARGA] = { |
9006 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, | 9119 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
9007 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | 9120 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
@@ -9908,10 +10021,12 @@ static int patch_alc882(struct hda_codec *codec) | |||
9908 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ | 10021 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
9909 | 10022 | ||
9910 | if (!spec->adc_nids && spec->input_mux) { | 10023 | if (!spec->adc_nids && spec->input_mux) { |
9911 | int i; | 10024 | int i, j; |
9912 | spec->num_adc_nids = 0; | 10025 | spec->num_adc_nids = 0; |
9913 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { | 10026 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
10027 | const struct hda_input_mux *imux = spec->input_mux; | ||
9914 | hda_nid_t cap; | 10028 | hda_nid_t cap; |
10029 | hda_nid_t items[16]; | ||
9915 | hda_nid_t nid = alc882_adc_nids[i]; | 10030 | hda_nid_t nid = alc882_adc_nids[i]; |
9916 | unsigned int wcap = get_wcaps(codec, nid); | 10031 | unsigned int wcap = get_wcaps(codec, nid); |
9917 | /* get type */ | 10032 | /* get type */ |
@@ -9922,6 +10037,15 @@ static int patch_alc882(struct hda_codec *codec) | |||
9922 | err = snd_hda_get_connections(codec, nid, &cap, 1); | 10037 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
9923 | if (err < 0) | 10038 | if (err < 0) |
9924 | continue; | 10039 | continue; |
10040 | err = snd_hda_get_connections(codec, cap, items, | ||
10041 | ARRAY_SIZE(items)); | ||
10042 | if (err < 0) | ||
10043 | continue; | ||
10044 | for (j = 0; j < imux->num_items; j++) | ||
10045 | if (imux->items[j].index >= err) | ||
10046 | break; | ||
10047 | if (j < imux->num_items) | ||
10048 | continue; | ||
9925 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; | 10049 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
9926 | spec->num_adc_nids++; | 10050 | spec->num_adc_nids++; |
9927 | } | 10051 | } |
@@ -16846,6 +16970,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = { | |||
16846 | ALC662_3ST_6ch_DIG), | 16970 | ALC662_3ST_6ch_DIG), |
16847 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", | 16971 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
16848 | ALC663_ASUS_H13), | 16972 | ALC663_ASUS_H13), |
16973 | SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG), | ||
16849 | {} | 16974 | {} |
16850 | }; | 16975 | }; |
16851 | 16976 | ||