aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-08-15 10:46:42 -0400
committerTakashi Iwai <tiwai@suse.de>2008-08-17 03:53:34 -0400
commitf511b01c8e747b80635c8b2acd61431abcab4b29 (patch)
tree5adfb3fa53c124341f790ead8b41ba7376f5555b
parent97bb8129e5deb3c0584391a5d2348966732e2233 (diff)
ALSA: hda - Fix capture source widgets on ALC codecs
On some Realtek codecs like ALC882 or ALC883, the capture source is no mux but sum widget. We have to initialize all channels properly for this type, otherwise noises may come in from the unused route. The patch assures to mute unused routes, and unmute the currently selected route. Signed-off-by: Takashi Iwai <tiwai@suse.de> Tested-by: Daniel J Blueman <daniel.blueman@gmail.com>
-rw-r--r--sound/pci/hda/patch_realtek.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index add4e87e0b20..b80e725432f0 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -6437,6 +6437,39 @@ static void alc882_auto_init_analog_input(struct hda_codec *codec)
6437 } 6437 }
6438} 6438}
6439 6439
6440static void alc882_auto_init_input_src(struct hda_codec *codec)
6441{
6442 struct alc_spec *spec = codec->spec;
6443 const struct hda_input_mux *imux = spec->input_mux;
6444 int c;
6445
6446 for (c = 0; c < spec->num_adc_nids; c++) {
6447 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
6448 hda_nid_t nid = spec->capsrc_nids[c];
6449 int conns, mute, idx, item;
6450
6451 conns = snd_hda_get_connections(codec, nid, conn_list,
6452 ARRAY_SIZE(conn_list));
6453 if (conns < 0)
6454 continue;
6455 for (idx = 0; idx < conns; idx++) {
6456 /* if the current connection is the selected one,
6457 * unmute it as default - otherwise mute it
6458 */
6459 mute = AMP_IN_MUTE(idx);
6460 for (item = 0; item < imux->num_items; item++) {
6461 if (imux->items[item].index == idx) {
6462 if (spec->cur_mux[c] == item)
6463 mute = AMP_IN_UNMUTE(idx);
6464 break;
6465 }
6466 }
6467 snd_hda_codec_write(codec, nid, 0,
6468 AC_VERB_SET_AMP_GAIN_MUTE, mute);
6469 }
6470 }
6471}
6472
6440/* add mic boosts if needed */ 6473/* add mic boosts if needed */
6441static int alc_auto_add_mic_boost(struct hda_codec *codec) 6474static int alc_auto_add_mic_boost(struct hda_codec *codec)
6442{ 6475{
@@ -6491,6 +6524,7 @@ static void alc882_auto_init(struct hda_codec *codec)
6491 alc882_auto_init_multi_out(codec); 6524 alc882_auto_init_multi_out(codec);
6492 alc882_auto_init_hp_out(codec); 6525 alc882_auto_init_hp_out(codec);
6493 alc882_auto_init_analog_input(codec); 6526 alc882_auto_init_analog_input(codec);
6527 alc882_auto_init_input_src(codec);
6494 if (spec->unsol_event) 6528 if (spec->unsol_event)
6495 alc_sku_automute(codec); 6529 alc_sku_automute(codec);
6496} 6530}
@@ -8285,6 +8319,8 @@ static void alc883_auto_init_analog_input(struct hda_codec *codec)
8285 } 8319 }
8286} 8320}
8287 8321
8322#define alc883_auto_init_input_src alc882_auto_init_input_src
8323
8288/* almost identical with ALC880 parser... */ 8324/* almost identical with ALC880 parser... */
8289static int alc883_parse_auto_config(struct hda_codec *codec) 8325static int alc883_parse_auto_config(struct hda_codec *codec)
8290{ 8326{
@@ -8315,6 +8351,7 @@ static void alc883_auto_init(struct hda_codec *codec)
8315 alc883_auto_init_multi_out(codec); 8351 alc883_auto_init_multi_out(codec);
8316 alc883_auto_init_hp_out(codec); 8352 alc883_auto_init_hp_out(codec);
8317 alc883_auto_init_analog_input(codec); 8353 alc883_auto_init_analog_input(codec);
8354 alc883_auto_init_input_src(codec);
8318 if (spec->unsol_event) 8355 if (spec->unsol_event)
8319 alc_sku_automute(codec); 8356 alc_sku_automute(codec);
8320} 8357}
@@ -9663,6 +9700,7 @@ static int alc262_parse_auto_config(struct hda_codec *codec)
9663#define alc262_auto_init_multi_out alc882_auto_init_multi_out 9700#define alc262_auto_init_multi_out alc882_auto_init_multi_out
9664#define alc262_auto_init_hp_out alc882_auto_init_hp_out 9701#define alc262_auto_init_hp_out alc882_auto_init_hp_out
9665#define alc262_auto_init_analog_input alc882_auto_init_analog_input 9702#define alc262_auto_init_analog_input alc882_auto_init_analog_input
9703#define alc262_auto_init_input_src alc882_auto_init_input_src
9666 9704
9667 9705
9668/* init callback for auto-configuration model -- overriding the default init */ 9706/* init callback for auto-configuration model -- overriding the default init */
@@ -9672,6 +9710,7 @@ static void alc262_auto_init(struct hda_codec *codec)
9672 alc262_auto_init_multi_out(codec); 9710 alc262_auto_init_multi_out(codec);
9673 alc262_auto_init_hp_out(codec); 9711 alc262_auto_init_hp_out(codec);
9674 alc262_auto_init_analog_input(codec); 9712 alc262_auto_init_analog_input(codec);
9713 alc262_auto_init_input_src(codec);
9675 if (spec->unsol_event) 9714 if (spec->unsol_event)
9676 alc_sku_automute(codec); 9715 alc_sku_automute(codec);
9677} 9716}
@@ -13330,6 +13369,8 @@ static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
13330 } 13369 }
13331} 13370}
13332 13371
13372#define alc861vd_auto_init_input_src alc882_auto_init_input_src
13373
13333#define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) 13374#define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
13334#define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) 13375#define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
13335 13376
@@ -13512,6 +13553,7 @@ static void alc861vd_auto_init(struct hda_codec *codec)
13512 alc861vd_auto_init_multi_out(codec); 13553 alc861vd_auto_init_multi_out(codec);
13513 alc861vd_auto_init_hp_out(codec); 13554 alc861vd_auto_init_hp_out(codec);
13514 alc861vd_auto_init_analog_input(codec); 13555 alc861vd_auto_init_analog_input(codec);
13556 alc861vd_auto_init_input_src(codec);
13515 if (spec->unsol_event) 13557 if (spec->unsol_event)
13516 alc_sku_automute(codec); 13558 alc_sku_automute(codec);
13517} 13559}
@@ -14677,6 +14719,8 @@ static void alc662_auto_init_analog_input(struct hda_codec *codec)
14677 } 14719 }
14678} 14720}
14679 14721
14722#define alc662_auto_init_input_src alc882_auto_init_input_src
14723
14680static int alc662_parse_auto_config(struct hda_codec *codec) 14724static int alc662_parse_auto_config(struct hda_codec *codec)
14681{ 14725{
14682 struct alc_spec *spec = codec->spec; 14726 struct alc_spec *spec = codec->spec;
@@ -14733,6 +14777,7 @@ static void alc662_auto_init(struct hda_codec *codec)
14733 alc662_auto_init_multi_out(codec); 14777 alc662_auto_init_multi_out(codec);
14734 alc662_auto_init_hp_out(codec); 14778 alc662_auto_init_hp_out(codec);
14735 alc662_auto_init_analog_input(codec); 14779 alc662_auto_init_analog_input(codec);
14780 alc662_auto_init_input_src(codec);
14736 if (spec->unsol_event) 14781 if (spec->unsol_event)
14737 alc_sku_automute(codec); 14782 alc_sku_automute(codec);
14738} 14783}