aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-02-12 12:32:23 -0500
committerTakashi Iwai <tiwai@suse.de>2008-04-24 06:00:10 -0400
commitf6c7e5461e9046445d50c5c7a9a4587824239623 (patch)
treee7fffba51f93339f10de792b338cc13a7cda7f3d /sound/pci
parent5832fcf8b55cfdbd7d8511f747d15fd20ed4703d (diff)
[ALSA] hda-codec - Fix auto-configuration of Realtek codecs
This patch fixes some bugs in the auto-configurator of Realtek codecs: - add missing pin set-up for speaker pins - fix the speaker auto-mute function not to conflict with the existing "Speaker" mixer switch Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/patch_realtek.c111
1 files changed, 63 insertions, 48 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index f1fa1d249369..d41eafacd86d 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -746,7 +746,6 @@ static struct hda_verb alc_gpio3_init_verbs[] = {
746static void alc_sku_automute(struct hda_codec *codec) 746static void alc_sku_automute(struct hda_codec *codec)
747{ 747{
748 struct alc_spec *spec = codec->spec; 748 struct alc_spec *spec = codec->spec;
749 unsigned int mute;
750 unsigned int present; 749 unsigned int present;
751 unsigned int hp_nid = spec->autocfg.hp_pins[0]; 750 unsigned int hp_nid = spec->autocfg.hp_pins[0];
752 unsigned int sp_nid = spec->autocfg.speaker_pins[0]; 751 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
@@ -756,16 +755,8 @@ static void alc_sku_automute(struct hda_codec *codec)
756 present = snd_hda_codec_read(codec, hp_nid, 0, 755 present = snd_hda_codec_read(codec, hp_nid, 0,
757 AC_VERB_GET_PIN_SENSE, 0); 756 AC_VERB_GET_PIN_SENSE, 0);
758 spec->jack_present = (present & 0x80000000) != 0; 757 spec->jack_present = (present & 0x80000000) != 0;
759 if (spec->jack_present) { 758 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
760 /* mute internal speaker */ 759 spec->jack_present ? 0 : PIN_OUT);
761 snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0,
762 HDA_AMP_MUTE, HDA_AMP_MUTE);
763 } else {
764 /* unmute internal speaker if necessary */
765 mute = snd_hda_codec_amp_read(codec, hp_nid, 0, HDA_OUTPUT, 0);
766 snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0,
767 HDA_AMP_MUTE, mute);
768 }
769} 760}
770 761
771/* unsolicited event for HP jack sensing */ 762/* unsolicited event for HP jack sensing */
@@ -3486,15 +3477,20 @@ static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3486 return 0; 3477 return 0;
3487} 3478}
3488 3479
3480static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
3481 unsigned int pin_type)
3482{
3483 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3484 pin_type);
3485 /* unmute pin */
3486 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, 0xff, 0x00);
3487}
3488
3489static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, 3489static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3490 hda_nid_t nid, int pin_type, 3490 hda_nid_t nid, int pin_type,
3491 int dac_idx) 3491 int dac_idx)
3492{ 3492{
3493 /* set as output */ 3493 alc_set_pin_output(codec, nid, pin_type);
3494 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3495 pin_type);
3496 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3497 AMP_OUT_UNMUTE);
3498 /* need the manual connection? */ 3494 /* need the manual connection? */
3499 if (alc880_is_multi_pin(nid)) { 3495 if (alc880_is_multi_pin(nid)) {
3500 struct alc_spec *spec = codec->spec; 3496 struct alc_spec *spec = codec->spec;
@@ -3616,9 +3612,12 @@ static int alc880_parse_auto_config(struct hda_codec *codec)
3616/* additional initialization for auto-configuration model */ 3612/* additional initialization for auto-configuration model */
3617static void alc880_auto_init(struct hda_codec *codec) 3613static void alc880_auto_init(struct hda_codec *codec)
3618{ 3614{
3615 struct alc_spec *spec = codec->spec;
3619 alc880_auto_init_multi_out(codec); 3616 alc880_auto_init_multi_out(codec);
3620 alc880_auto_init_extra_out(codec); 3617 alc880_auto_init_extra_out(codec);
3621 alc880_auto_init_analog_input(codec); 3618 alc880_auto_init_analog_input(codec);
3619 if (spec->unsol_event)
3620 alc_sku_automute(codec);
3622} 3621}
3623 3622
3624/* 3623/*
@@ -4814,11 +4813,7 @@ static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
4814 hda_nid_t nid, int pin_type, 4813 hda_nid_t nid, int pin_type,
4815 int sel_idx) 4814 int sel_idx)
4816{ 4815{
4817 /* set as output */ 4816 alc_set_pin_output(codec, nid, pin_type);
4818 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4819 pin_type);
4820 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4821 AMP_OUT_UNMUTE);
4822 /* need the manual connection? */ 4817 /* need the manual connection? */
4823 if (nid >= 0x12) { 4818 if (nid >= 0x12) {
4824 int idx = nid - 0x12; 4819 int idx = nid - 0x12;
@@ -4965,8 +4960,11 @@ static int alc260_parse_auto_config(struct hda_codec *codec)
4965/* additional initialization for auto-configuration model */ 4960/* additional initialization for auto-configuration model */
4966static void alc260_auto_init(struct hda_codec *codec) 4961static void alc260_auto_init(struct hda_codec *codec)
4967{ 4962{
4963 struct alc_spec *spec = codec->spec;
4968 alc260_auto_init_multi_out(codec); 4964 alc260_auto_init_multi_out(codec);
4969 alc260_auto_init_analog_input(codec); 4965 alc260_auto_init_analog_input(codec);
4966 if (spec->unsol_event)
4967 alc_sku_automute(codec);
4970} 4968}
4971 4969
4972#ifdef CONFIG_SND_HDA_POWER_SAVE 4970#ifdef CONFIG_SND_HDA_POWER_SAVE
@@ -6201,15 +6199,11 @@ static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6201 struct alc_spec *spec = codec->spec; 6199 struct alc_spec *spec = codec->spec;
6202 int idx; 6200 int idx;
6203 6201
6202 alc_set_pin_output(codec, nid, pin_type);
6204 if (spec->multiout.dac_nids[dac_idx] == 0x25) 6203 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6205 idx = 4; 6204 idx = 4;
6206 else 6205 else
6207 idx = spec->multiout.dac_nids[dac_idx] - 2; 6206 idx = spec->multiout.dac_nids[dac_idx] - 2;
6208
6209 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6210 pin_type);
6211 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
6212 AMP_OUT_UNMUTE);
6213 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); 6207 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6214 6208
6215} 6209}
@@ -6238,6 +6232,9 @@ static void alc882_auto_init_hp_out(struct hda_codec *codec)
6238 if (pin) /* connect to front */ 6232 if (pin) /* connect to front */
6239 /* use dac 0 */ 6233 /* use dac 0 */
6240 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); 6234 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6235 pin = spec->autocfg.speaker_pins[0];
6236 if (pin)
6237 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6241} 6238}
6242 6239
6243#define alc882_is_input_pin(nid) alc880_is_input_pin(nid) 6240#define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
@@ -6313,9 +6310,12 @@ static int alc882_parse_auto_config(struct hda_codec *codec)
6313/* additional initialization for auto-configuration model */ 6310/* additional initialization for auto-configuration model */
6314static void alc882_auto_init(struct hda_codec *codec) 6311static void alc882_auto_init(struct hda_codec *codec)
6315{ 6312{
6313 struct alc_spec *spec = codec->spec;
6316 alc882_auto_init_multi_out(codec); 6314 alc882_auto_init_multi_out(codec);
6317 alc882_auto_init_hp_out(codec); 6315 alc882_auto_init_hp_out(codec);
6318 alc882_auto_init_analog_input(codec); 6316 alc882_auto_init_analog_input(codec);
6317 if (spec->unsol_event)
6318 alc_sku_automute(codec);
6319} 6319}
6320 6320
6321static int patch_alc882(struct hda_codec *codec) 6321static int patch_alc882(struct hda_codec *codec)
@@ -7878,15 +7878,11 @@ static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
7878 struct alc_spec *spec = codec->spec; 7878 struct alc_spec *spec = codec->spec;
7879 int idx; 7879 int idx;
7880 7880
7881 alc_set_pin_output(codec, nid, pin_type);
7881 if (spec->multiout.dac_nids[dac_idx] == 0x25) 7882 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7882 idx = 4; 7883 idx = 4;
7883 else 7884 else
7884 idx = spec->multiout.dac_nids[dac_idx] - 2; 7885 idx = spec->multiout.dac_nids[dac_idx] - 2;
7885
7886 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7887 pin_type);
7888 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
7889 AMP_OUT_UNMUTE);
7890 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); 7886 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7891 7887
7892} 7888}
@@ -7915,6 +7911,9 @@ static void alc883_auto_init_hp_out(struct hda_codec *codec)
7915 if (pin) /* connect to front */ 7911 if (pin) /* connect to front */
7916 /* use dac 0 */ 7912 /* use dac 0 */
7917 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); 7913 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7914 pin = spec->autocfg.speaker_pins[0];
7915 if (pin)
7916 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
7918} 7917}
7919 7918
7920#define alc883_is_input_pin(nid) alc880_is_input_pin(nid) 7919#define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
@@ -7966,9 +7965,12 @@ static int alc883_parse_auto_config(struct hda_codec *codec)
7966/* additional initialization for auto-configuration model */ 7965/* additional initialization for auto-configuration model */
7967static void alc883_auto_init(struct hda_codec *codec) 7966static void alc883_auto_init(struct hda_codec *codec)
7968{ 7967{
7968 struct alc_spec *spec = codec->spec;
7969 alc883_auto_init_multi_out(codec); 7969 alc883_auto_init_multi_out(codec);
7970 alc883_auto_init_hp_out(codec); 7970 alc883_auto_init_hp_out(codec);
7971 alc883_auto_init_analog_input(codec); 7971 alc883_auto_init_analog_input(codec);
7972 if (spec->unsol_event)
7973 alc_sku_automute(codec);
7972} 7974}
7973 7975
7974static int patch_alc883(struct hda_codec *codec) 7976static int patch_alc883(struct hda_codec *codec)
@@ -9144,9 +9146,12 @@ static int alc262_parse_auto_config(struct hda_codec *codec)
9144/* init callback for auto-configuration model -- overriding the default init */ 9146/* init callback for auto-configuration model -- overriding the default init */
9145static void alc262_auto_init(struct hda_codec *codec) 9147static void alc262_auto_init(struct hda_codec *codec)
9146{ 9148{
9149 struct alc_spec *spec = codec->spec;
9147 alc262_auto_init_multi_out(codec); 9150 alc262_auto_init_multi_out(codec);
9148 alc262_auto_init_hp_out(codec); 9151 alc262_auto_init_hp_out(codec);
9149 alc262_auto_init_analog_input(codec); 9152 alc262_auto_init_analog_input(codec);
9153 if (spec->unsol_event)
9154 alc_sku_automute(codec);
9150} 9155}
9151 9156
9152/* 9157/*
@@ -10033,10 +10038,13 @@ static int alc268_parse_auto_config(struct hda_codec *codec)
10033/* init callback for auto-configuration model -- overriding the default init */ 10038/* init callback for auto-configuration model -- overriding the default init */
10034static void alc268_auto_init(struct hda_codec *codec) 10039static void alc268_auto_init(struct hda_codec *codec)
10035{ 10040{
10041 struct alc_spec *spec = codec->spec;
10036 alc268_auto_init_multi_out(codec); 10042 alc268_auto_init_multi_out(codec);
10037 alc268_auto_init_hp_out(codec); 10043 alc268_auto_init_hp_out(codec);
10038 alc268_auto_init_mono_speaker_out(codec); 10044 alc268_auto_init_mono_speaker_out(codec);
10039 alc268_auto_init_analog_input(codec); 10045 alc268_auto_init_analog_input(codec);
10046 if (spec->unsol_event)
10047 alc_sku_automute(codec);
10040} 10048}
10041 10049
10042/* 10050/*
@@ -10505,9 +10513,12 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
10505/* init callback for auto-configuration model -- overriding the default init */ 10513/* init callback for auto-configuration model -- overriding the default init */
10506static void alc269_auto_init(struct hda_codec *codec) 10514static void alc269_auto_init(struct hda_codec *codec)
10507{ 10515{
10516 struct alc_spec *spec = codec->spec;
10508 alc269_auto_init_multi_out(codec); 10517 alc269_auto_init_multi_out(codec);
10509 alc269_auto_init_hp_out(codec); 10518 alc269_auto_init_hp_out(codec);
10510 alc269_auto_init_analog_input(codec); 10519 alc269_auto_init_analog_input(codec);
10520 if (spec->unsol_event)
10521 alc_sku_automute(codec);
10511} 10522}
10512 10523
10513/* 10524/*
@@ -11429,13 +11440,7 @@ static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
11429 hda_nid_t nid, 11440 hda_nid_t nid,
11430 int pin_type, int dac_idx) 11441 int pin_type, int dac_idx)
11431{ 11442{
11432 /* set as output */ 11443 alc_set_pin_output(codec, nid, pin_type);
11433
11434 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11435 pin_type);
11436 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11437 AMP_OUT_UNMUTE);
11438
11439} 11444}
11440 11445
11441static void alc861_auto_init_multi_out(struct hda_codec *codec) 11446static void alc861_auto_init_multi_out(struct hda_codec *codec)
@@ -11462,6 +11467,9 @@ static void alc861_auto_init_hp_out(struct hda_codec *codec)
11462 if (pin) /* connect to front */ 11467 if (pin) /* connect to front */
11463 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, 11468 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
11464 spec->multiout.dac_nids[0]); 11469 spec->multiout.dac_nids[0]);
11470 pin = spec->autocfg.speaker_pins[0];
11471 if (pin)
11472 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
11465} 11473}
11466 11474
11467static void alc861_auto_init_analog_input(struct hda_codec *codec) 11475static void alc861_auto_init_analog_input(struct hda_codec *codec)
@@ -11534,9 +11542,12 @@ static int alc861_parse_auto_config(struct hda_codec *codec)
11534/* additional initialization for auto-configuration model */ 11542/* additional initialization for auto-configuration model */
11535static void alc861_auto_init(struct hda_codec *codec) 11543static void alc861_auto_init(struct hda_codec *codec)
11536{ 11544{
11545 struct alc_spec *spec = codec->spec;
11537 alc861_auto_init_multi_out(codec); 11546 alc861_auto_init_multi_out(codec);
11538 alc861_auto_init_hp_out(codec); 11547 alc861_auto_init_hp_out(codec);
11539 alc861_auto_init_analog_input(codec); 11548 alc861_auto_init_analog_input(codec);
11549 if (spec->unsol_event)
11550 alc_sku_automute(codec);
11540} 11551}
11541 11552
11542#ifdef CONFIG_SND_HDA_POWER_SAVE 11553#ifdef CONFIG_SND_HDA_POWER_SAVE
@@ -12397,11 +12408,7 @@ static struct alc_config_preset alc861vd_presets[] = {
12397static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, 12408static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
12398 hda_nid_t nid, int pin_type, int dac_idx) 12409 hda_nid_t nid, int pin_type, int dac_idx)
12399{ 12410{
12400 /* set as output */ 12411 alc_set_pin_output(codec, nid, pin_type);
12401 snd_hda_codec_write(codec, nid, 0,
12402 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
12403 snd_hda_codec_write(codec, nid, 0,
12404 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
12405} 12412}
12406 12413
12407static void alc861vd_auto_init_multi_out(struct hda_codec *codec) 12414static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
@@ -12428,6 +12435,9 @@ static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
12428 pin = spec->autocfg.hp_pins[0]; 12435 pin = spec->autocfg.hp_pins[0];
12429 if (pin) /* connect to front and use dac 0 */ 12436 if (pin) /* connect to front and use dac 0 */
12430 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); 12437 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
12438 pin = spec->autocfg.speaker_pins[0];
12439 if (pin)
12440 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
12431} 12441}
12432 12442
12433#define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) 12443#define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
@@ -12631,9 +12641,12 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec)
12631/* additional initialization for auto-configuration model */ 12641/* additional initialization for auto-configuration model */
12632static void alc861vd_auto_init(struct hda_codec *codec) 12642static void alc861vd_auto_init(struct hda_codec *codec)
12633{ 12643{
12644 struct alc_spec *spec = codec->spec;
12634 alc861vd_auto_init_multi_out(codec); 12645 alc861vd_auto_init_multi_out(codec);
12635 alc861vd_auto_init_hp_out(codec); 12646 alc861vd_auto_init_hp_out(codec);
12636 alc861vd_auto_init_analog_input(codec); 12647 alc861vd_auto_init_analog_input(codec);
12648 if (spec->unsol_event)
12649 alc_sku_automute(codec);
12637} 12650}
12638 12651
12639static int patch_alc861vd(struct hda_codec *codec) 12652static int patch_alc861vd(struct hda_codec *codec)
@@ -13453,11 +13466,7 @@ static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
13453 hda_nid_t nid, int pin_type, 13466 hda_nid_t nid, int pin_type,
13454 int dac_idx) 13467 int dac_idx)
13455{ 13468{
13456 /* set as output */ 13469 alc_set_pin_output(codec, nid, pin_type);
13457 snd_hda_codec_write(codec, nid, 0,
13458 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
13459 snd_hda_codec_write(codec, nid, 0,
13460 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
13461 /* need the manual connection? */ 13470 /* need the manual connection? */
13462 if (alc880_is_multi_pin(nid)) { 13471 if (alc880_is_multi_pin(nid)) {
13463 struct alc_spec *spec = codec->spec; 13472 struct alc_spec *spec = codec->spec;
@@ -13492,6 +13501,9 @@ static void alc662_auto_init_hp_out(struct hda_codec *codec)
13492 if (pin) /* connect to front */ 13501 if (pin) /* connect to front */
13493 /* use dac 0 */ 13502 /* use dac 0 */
13494 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); 13503 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
13504 pin = spec->autocfg.speaker_pins[0];
13505 if (pin)
13506 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13495} 13507}
13496 13508
13497#define alc662_is_input_pin(nid) alc880_is_input_pin(nid) 13509#define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
@@ -13569,9 +13581,12 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
13569/* additional initialization for auto-configuration model */ 13581/* additional initialization for auto-configuration model */
13570static void alc662_auto_init(struct hda_codec *codec) 13582static void alc662_auto_init(struct hda_codec *codec)
13571{ 13583{
13584 struct alc_spec *spec = codec->spec;
13572 alc662_auto_init_multi_out(codec); 13585 alc662_auto_init_multi_out(codec);
13573 alc662_auto_init_hp_out(codec); 13586 alc662_auto_init_hp_out(codec);
13574 alc662_auto_init_analog_input(codec); 13587 alc662_auto_init_analog_input(codec);
13588 if (spec->unsol_event)
13589 alc_sku_automute(codec);
13575} 13590}
13576 13591
13577static int patch_alc662(struct hda_codec *codec) 13592static int patch_alc662(struct hda_codec *codec)