aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-01-19 09:53:43 -0500
committerTakashi Iwai <tiwai@suse.de>2010-01-19 09:53:43 -0500
commit9e4c84967ef027fe50a03cf48dd6da9519c8e60c (patch)
tree21d6b8168670f22521f3bb703e3b9d1932566c1c /sound/pci/hda/patch_realtek.c
parentd2f2fcd2541bae004db7f4798ffd9d2cb75ae817 (diff)
parent3fb4a508b8e7957aa899f32cd6d9d462e102c7ca (diff)
Merge branch 'fix/hda' into topic/hda
Conflicts: sound/pci/hda/patch_realtek.c
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c133
1 files changed, 105 insertions, 28 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 141ff446104..c53faa95939 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1097,6 +1097,16 @@ static void alc889_coef_init(struct hda_codec *codec)
1097 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); 1097 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1098} 1098}
1099 1099
1100/* turn on/off EAPD control (only if available) */
1101static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1102{
1103 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1104 return;
1105 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1106 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1107 on ? 2 : 0);
1108}
1109
1100static void alc_auto_init_amp(struct hda_codec *codec, int type) 1110static void alc_auto_init_amp(struct hda_codec *codec, int type)
1101{ 1111{
1102 unsigned int tmp; 1112 unsigned int tmp;
@@ -1114,25 +1124,22 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type)
1114 case ALC_INIT_DEFAULT: 1124 case ALC_INIT_DEFAULT:
1115 switch (codec->vendor_id) { 1125 switch (codec->vendor_id) {
1116 case 0x10ec0260: 1126 case 0x10ec0260:
1117 snd_hda_codec_write(codec, 0x0f, 0, 1127 set_eapd(codec, 0x0f, 1);
1118 AC_VERB_SET_EAPD_BTLENABLE, 2); 1128 set_eapd(codec, 0x10, 1);
1119 snd_hda_codec_write(codec, 0x10, 0,
1120 AC_VERB_SET_EAPD_BTLENABLE, 2);
1121 break; 1129 break;
1122 case 0x10ec0262: 1130 case 0x10ec0262:
1123 case 0x10ec0267: 1131 case 0x10ec0267:
1124 case 0x10ec0268: 1132 case 0x10ec0268:
1125 case 0x10ec0269: 1133 case 0x10ec0269:
1134 case 0x10ec0270:
1126 case 0x10ec0272: 1135 case 0x10ec0272:
1127 case 0x10ec0660: 1136 case 0x10ec0660:
1128 case 0x10ec0662: 1137 case 0x10ec0662:
1129 case 0x10ec0663: 1138 case 0x10ec0663:
1130 case 0x10ec0862: 1139 case 0x10ec0862:
1131 case 0x10ec0889: 1140 case 0x10ec0889:
1132 snd_hda_codec_write(codec, 0x14, 0, 1141 set_eapd(codec, 0x14, 1);
1133 AC_VERB_SET_EAPD_BTLENABLE, 2); 1142 set_eapd(codec, 0x15, 1);
1134 snd_hda_codec_write(codec, 0x15, 0,
1135 AC_VERB_SET_EAPD_BTLENABLE, 2);
1136 break; 1143 break;
1137 } 1144 }
1138 switch (codec->vendor_id) { 1145 switch (codec->vendor_id) {
@@ -1234,6 +1241,8 @@ static void alc_init_auto_mic(struct hda_codec *codec)
1234 return; /* invalid entry */ 1241 return; /* invalid entry */
1235 } 1242 }
1236 } 1243 }
1244 if (!ext || !fixed)
1245 return;
1237 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) 1246 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1238 return; /* no unsol support */ 1247 return; /* no unsol support */
1239 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", 1248 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
@@ -3720,25 +3729,22 @@ static void alc_power_eapd(struct hda_codec *codec)
3720 /* We currently only handle front, HP */ 3729 /* We currently only handle front, HP */
3721 switch (codec->vendor_id) { 3730 switch (codec->vendor_id) {
3722 case 0x10ec0260: 3731 case 0x10ec0260:
3723 snd_hda_codec_write(codec, 0x0f, 0, 3732 set_eapd(codec, 0x0f, 0);
3724 AC_VERB_SET_EAPD_BTLENABLE, 0x00); 3733 set_eapd(codec, 0x10, 0);
3725 snd_hda_codec_write(codec, 0x10, 0,
3726 AC_VERB_SET_EAPD_BTLENABLE, 0x00);
3727 break; 3734 break;
3728 case 0x10ec0262: 3735 case 0x10ec0262:
3729 case 0x10ec0267: 3736 case 0x10ec0267:
3730 case 0x10ec0268: 3737 case 0x10ec0268:
3731 case 0x10ec0269: 3738 case 0x10ec0269:
3739 case 0x10ec0270:
3732 case 0x10ec0272: 3740 case 0x10ec0272:
3733 case 0x10ec0660: 3741 case 0x10ec0660:
3734 case 0x10ec0662: 3742 case 0x10ec0662:
3735 case 0x10ec0663: 3743 case 0x10ec0663:
3736 case 0x10ec0862: 3744 case 0x10ec0862:
3737 case 0x10ec0889: 3745 case 0x10ec0889:
3738 snd_hda_codec_write(codec, 0x14, 0, 3746 set_eapd(codec, 0x14, 0);
3739 AC_VERB_SET_EAPD_BTLENABLE, 0x00); 3747 set_eapd(codec, 0x15, 0);
3740 snd_hda_codec_write(codec, 0x15, 0,
3741 AC_VERB_SET_EAPD_BTLENABLE, 0x00);
3742 break; 3748 break;
3743 } 3749 }
3744} 3750}
@@ -4917,6 +4923,49 @@ static void fixup_automic_adc(struct hda_codec *codec)
4917 spec->auto_mic = 0; /* disable auto-mic to be sure */ 4923 spec->auto_mic = 0; /* disable auto-mic to be sure */
4918} 4924}
4919 4925
4926/* choose the ADC/MUX containing the input pin and initialize the setup */
4927static void fixup_single_adc(struct hda_codec *codec)
4928{
4929 struct alc_spec *spec = codec->spec;
4930 hda_nid_t pin;
4931 int i;
4932
4933 /* search for the input pin; there must be only one */
4934 for (i = 0; i < AUTO_PIN_LAST; i++) {
4935 if (spec->autocfg.input_pins[i]) {
4936 pin = spec->autocfg.input_pins[i];
4937 break;
4938 }
4939 }
4940 if (!pin)
4941 return;
4942
4943 /* set the default connection to that pin */
4944 for (i = 0; i < spec->num_adc_nids; i++) {
4945 hda_nid_t cap = spec->capsrc_nids ?
4946 spec->capsrc_nids[i] : spec->adc_nids[i];
4947 int idx;
4948
4949 idx = get_connection_index(codec, cap, pin);
4950 if (idx < 0)
4951 continue;
4952 /* use only this ADC */
4953 if (spec->capsrc_nids)
4954 spec->capsrc_nids += i;
4955 spec->adc_nids += i;
4956 spec->num_adc_nids = 1;
4957 /* select or unmute this route */
4958 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
4959 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
4960 HDA_AMP_MUTE, 0);
4961 } else {
4962 snd_hda_codec_write_cache(codec, cap, 0,
4963 AC_VERB_SET_CONNECT_SEL, idx);
4964 }
4965 return;
4966 }
4967}
4968
4920static void set_capture_mixer(struct hda_codec *codec) 4969static void set_capture_mixer(struct hda_codec *codec)
4921{ 4970{
4922 struct alc_spec *spec = codec->spec; 4971 struct alc_spec *spec = codec->spec;
@@ -4929,14 +4978,15 @@ static void set_capture_mixer(struct hda_codec *codec)
4929 alc_capture_mixer3 }, 4978 alc_capture_mixer3 },
4930 }; 4979 };
4931 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { 4980 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4932 int mux; 4981 int mux = 0;
4933 if (spec->auto_mic) { 4982 if (spec->auto_mic)
4934 mux = 0;
4935 fixup_automic_adc(codec); 4983 fixup_automic_adc(codec);
4936 } else if (spec->input_mux && spec->input_mux->num_items > 1) 4984 else if (spec->input_mux) {
4937 mux = 1; 4985 if (spec->input_mux->num_items > 1)
4938 else 4986 mux = 1;
4939 mux = 0; 4987 else if (spec->input_mux->num_items == 1)
4988 fixup_single_adc(codec);
4989 }
4940 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; 4990 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4941 } 4991 }
4942} 4992}
@@ -7201,8 +7251,8 @@ static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7201 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), 7251 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7202 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), 7252 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7203 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), 7253 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7204 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT), 7254 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7205 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT), 7255 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7206 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 7256 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7207 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 7257 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7208 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), 7258 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
@@ -7603,6 +7653,7 @@ static struct hda_verb alc885_mb5_init_verbs[] = {
7603 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 7653 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7604 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7654 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7605 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, 7655 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7656 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7606 /* Front Mic pin: input vref at 80% */ 7657 /* Front Mic pin: input vref at 80% */
7607 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 7658 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7608 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 7659 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
@@ -7787,6 +7838,27 @@ static void alc885_mbp3_setup(struct hda_codec *codec)
7787 spec->autocfg.speaker_pins[0] = 0x14; 7838 spec->autocfg.speaker_pins[0] = 0x14;
7788} 7839}
7789 7840
7841static void alc885_mb5_automute(struct hda_codec *codec)
7842{
7843 unsigned int present;
7844
7845 present = snd_hda_codec_read(codec, 0x14, 0,
7846 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7847 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
7848 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7849 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7850 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7851
7852}
7853
7854static void alc885_mb5_unsol_event(struct hda_codec *codec,
7855 unsigned int res)
7856{
7857 /* Headphone insertion or removal. */
7858 if ((res >> 26) == ALC880_HP_EVENT)
7859 alc885_mb5_automute(codec);
7860}
7861
7790static void alc885_imac91_automute(struct hda_codec *codec) 7862static void alc885_imac91_automute(struct hda_codec *codec)
7791{ 7863{
7792 unsigned int present; 7864 unsigned int present;
@@ -9233,6 +9305,8 @@ static struct alc_config_preset alc882_presets[] = {
9233 .input_mux = &mb5_capture_source, 9305 .input_mux = &mb5_capture_source,
9234 .dig_out_nid = ALC882_DIGOUT_NID, 9306 .dig_out_nid = ALC882_DIGOUT_NID,
9235 .dig_in_nid = ALC882_DIGIN_NID, 9307 .dig_in_nid = ALC882_DIGIN_NID,
9308 .unsol_event = alc885_mb5_unsol_event,
9309 .init_hook = alc885_mb5_automute,
9236 }, 9310 },
9237 [ALC885_MACPRO] = { 9311 [ALC885_MACPRO] = {
9238 .mixers = { alc882_macpro_mixer }, 9312 .mixers = { alc882_macpro_mixer },
@@ -11310,7 +11384,7 @@ static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11310} 11384}
11311 11385
11312#define alc262_auto_create_input_ctls \ 11386#define alc262_auto_create_input_ctls \
11313 alc880_auto_create_input_ctls 11387 alc882_auto_create_input_ctls
11314 11388
11315/* 11389/*
11316 * generic initialization of ADC, input mixers and output mixers 11390 * generic initialization of ADC, input mixers and output mixers
@@ -12605,6 +12679,7 @@ static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12605 dac = 0x02; 12679 dac = 0x02;
12606 break; 12680 break;
12607 case 0x15: 12681 case 0x15:
12682 case 0x21:
12608 dac = 0x03; 12683 dac = 0x03;
12609 break; 12684 break;
12610 default: 12685 default:
@@ -14991,6 +15066,8 @@ static int patch_alc861(struct hda_codec *codec)
14991 spec->stream_digital_playback = &alc861_pcm_digital_playback; 15066 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14992 spec->stream_digital_capture = &alc861_pcm_digital_capture; 15067 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14993 15068
15069 if (!spec->cap_mixer)
15070 set_capture_mixer(codec);
14994 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); 15071 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14995 15072
14996 spec->vmaster_nid = 0x03; 15073 spec->vmaster_nid = 0x03;
@@ -15633,7 +15710,7 @@ static struct alc_config_preset alc861vd_presets[] = {
15633static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, 15710static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15634 const struct auto_pin_cfg *cfg) 15711 const struct auto_pin_cfg *cfg)
15635{ 15712{
15636 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); 15713 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x22, 0);
15637} 15714}
15638 15715
15639 15716
@@ -17391,7 +17468,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
17391 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), 17468 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17392 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", 17469 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17393 ALC662_3ST_6ch_DIG), 17470 ALC662_3ST_6ch_DIG),
17394 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4), 17471 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
17395 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), 17472 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17396 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", 17473 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17397 ALC662_3ST_6ch_DIG), 17474 ALC662_3ST_6ch_DIG),