diff options
author | Herton Ronaldo Krzesinski <herton@mandriva.com.br> | 2009-01-29 10:18:31 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-01-29 10:33:02 -0500 |
commit | b98b7b347eed333d6fa2f74770beb8106e576cc6 (patch) | |
tree | fcf12b19eec4f09df1eff254159bf1d3be022b1c | |
parent | 61b9b9b109217b2bfb128c3ca24d8f8c839a425f (diff) |
ALSA: hda - make alc882_auto_init_input_src aware of selectors
In the case of having a selector instead of mixer while initing input
sources, the case that happens with ALC889, we must select instead
of muting input. Problem was found while testing with hda-emu.
Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index d81cb5eb8c5..3666cc5dc3b 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -6924,18 +6924,21 @@ static void alc882_auto_init_analog_input(struct hda_codec *codec) | |||
6924 | static void alc882_auto_init_input_src(struct hda_codec *codec) | 6924 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
6925 | { | 6925 | { |
6926 | struct alc_spec *spec = codec->spec; | 6926 | struct alc_spec *spec = codec->spec; |
6927 | const struct hda_input_mux *imux = spec->input_mux; | ||
6928 | int c; | 6927 | int c; |
6929 | 6928 | ||
6930 | for (c = 0; c < spec->num_adc_nids; c++) { | 6929 | for (c = 0; c < spec->num_adc_nids; c++) { |
6931 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; | 6930 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
6932 | hda_nid_t nid = spec->capsrc_nids[c]; | 6931 | hda_nid_t nid = spec->capsrc_nids[c]; |
6932 | unsigned int mux_idx; | ||
6933 | const struct hda_input_mux *imux; | ||
6933 | int conns, mute, idx, item; | 6934 | int conns, mute, idx, item; |
6934 | 6935 | ||
6935 | conns = snd_hda_get_connections(codec, nid, conn_list, | 6936 | conns = snd_hda_get_connections(codec, nid, conn_list, |
6936 | ARRAY_SIZE(conn_list)); | 6937 | ARRAY_SIZE(conn_list)); |
6937 | if (conns < 0) | 6938 | if (conns < 0) |
6938 | continue; | 6939 | continue; |
6940 | mux_idx = c >= spec->num_mux_defs ? 0 : c; | ||
6941 | imux = &spec->input_mux[mux_idx]; | ||
6939 | for (idx = 0; idx < conns; idx++) { | 6942 | for (idx = 0; idx < conns; idx++) { |
6940 | /* if the current connection is the selected one, | 6943 | /* if the current connection is the selected one, |
6941 | * unmute it as default - otherwise mute it | 6944 | * unmute it as default - otherwise mute it |
@@ -6948,8 +6951,20 @@ static void alc882_auto_init_input_src(struct hda_codec *codec) | |||
6948 | break; | 6951 | break; |
6949 | } | 6952 | } |
6950 | } | 6953 | } |
6951 | snd_hda_codec_write(codec, nid, 0, | 6954 | /* check if we have a selector or mixer |
6952 | AC_VERB_SET_AMP_GAIN_MUTE, mute); | 6955 | * we could check for the widget type instead, but |
6956 | * just check for Amp-In presence (in case of mixer | ||
6957 | * without amp-in there is something wrong, this | ||
6958 | * function shouldn't be used or capsrc nid is wrong) | ||
6959 | */ | ||
6960 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) | ||
6961 | snd_hda_codec_write(codec, nid, 0, | ||
6962 | AC_VERB_SET_AMP_GAIN_MUTE, | ||
6963 | mute); | ||
6964 | else if (mute != AMP_IN_MUTE(idx)) | ||
6965 | snd_hda_codec_write(codec, nid, 0, | ||
6966 | AC_VERB_SET_CONNECT_SEL, | ||
6967 | idx); | ||
6953 | } | 6968 | } |
6954 | } | 6969 | } |
6955 | } | 6970 | } |