From b006d12bd697af0385678860fc6b79727d204dca Mon Sep 17 00:00:00 2001 From: Herton Ronaldo Krzesinski Date: Thu, 29 Jan 2009 13:18:31 -0200 Subject: [PATCH] --- yaml --- r: 133009 b: refs/heads/master c: b98b7b347eed333d6fa2f74770beb8106e576cc6 h: refs/heads/master i: 133007: fb4ddf7251a5359fc9e1e2a097b12706526ab313 v: v3 --- [refs] | 2 +- trunk/sound/pci/hda/patch_realtek.c | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 6b6f86e51750..d1a11c9bda1d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 61b9b9b109217b2bfb128c3ca24d8f8c839a425f +refs/heads/master: b98b7b347eed333d6fa2f74770beb8106e576cc6 diff --git a/trunk/sound/pci/hda/patch_realtek.c b/trunk/sound/pci/hda/patch_realtek.c index d81cb5eb8c5f..3666cc5dc3bc 100644 --- a/trunk/sound/pci/hda/patch_realtek.c +++ b/trunk/sound/pci/hda/patch_realtek.c @@ -6924,18 +6924,21 @@ static void alc882_auto_init_analog_input(struct hda_codec *codec) static void alc882_auto_init_input_src(struct hda_codec *codec) { struct alc_spec *spec = codec->spec; - const struct hda_input_mux *imux = spec->input_mux; int c; for (c = 0; c < spec->num_adc_nids; c++) { hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; hda_nid_t nid = spec->capsrc_nids[c]; + unsigned int mux_idx; + const struct hda_input_mux *imux; int conns, mute, idx, item; conns = snd_hda_get_connections(codec, nid, conn_list, ARRAY_SIZE(conn_list)); if (conns < 0) continue; + mux_idx = c >= spec->num_mux_defs ? 0 : c; + imux = &spec->input_mux[mux_idx]; for (idx = 0; idx < conns; idx++) { /* if the current connection is the selected one, * unmute it as default - otherwise mute it @@ -6948,8 +6951,20 @@ static void alc882_auto_init_input_src(struct hda_codec *codec) break; } } - snd_hda_codec_write(codec, nid, 0, - AC_VERB_SET_AMP_GAIN_MUTE, mute); + /* check if we have a selector or mixer + * we could check for the widget type instead, but + * just check for Amp-In presence (in case of mixer + * without amp-in there is something wrong, this + * function shouldn't be used or capsrc nid is wrong) + */ + if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) + snd_hda_codec_write(codec, nid, 0, + AC_VERB_SET_AMP_GAIN_MUTE, + mute); + else if (mute != AMP_IN_MUTE(idx)) + snd_hda_codec_write(codec, nid, 0, + AC_VERB_SET_CONNECT_SEL, + idx); } } }