summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-04-06 15:16:21 +0200
committerTakashi Iwai <tiwai@suse.de>2011-04-06 15:16:21 +0200
commit1304ac8993e32c0530bc82bf1d3f953548a20971 (patch)
tree2ffd4941bd0ae86a3b343e98e8cf8d581b360790 /sound
parentALSA: hda - Correct initial dac_nids for some ALC272-quirks (diff)
downloadlinux-1304ac8993e32c0530bc82bf1d3f953548a20971.tar.xz
linux-1304ac8993e32c0530bc82bf1d3f953548a20971.zip
ALSA: hda - Fix mix->DAC deduction for ALC892
The current alc662 parser doesn't set the DAC for the mixer 0x0f properly for ALC892, which has 4 DACs while ALC662 has 3. Fixed by implementing alc662_mix_to_dac() more genericly with the dynamic widget list. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_realtek.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index e62fe7f2aeff..d566eac08d6c 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -19105,16 +19105,17 @@ static struct alc_config_preset alc662_presets[] = {
*/
/* convert from MIX nid to DAC */
-static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
-{
- if (nid == 0x0f)
- return 0x02;
- else if (nid >= 0x0c && nid <= 0x0e)
- return nid - 0x0c + 0x02;
- else if (nid == 0x26) /* ALC887-VD has this DAC too */
- return 0x25;
- else
- return 0;
+static hda_nid_t alc662_mix_to_dac(struct hda_codec *codec, hda_nid_t nid)
+{
+ hda_nid_t list[4];
+ int i, num;
+
+ num = snd_hda_get_connections(codec, nid, list, ARRAY_SIZE(list));
+ for (i = 0; i < num; i++) {
+ if (get_wcaps_type(get_wcaps(codec, list[i])) == AC_WID_AUD_OUT)
+ return list[i];
+ }
+ return 0;
}
/* get MIX nid connected to the given pin targeted to DAC */
@@ -19126,7 +19127,7 @@ static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
for (i = 0; i < num; i++) {
- if (alc662_mix_to_dac(mix[i]) == dac)
+ if (alc662_mix_to_dac(codec, mix[i]) == dac)
return mix[i];
}
return 0;
@@ -19143,7 +19144,7 @@ static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
if (num < 0)
return 0;
for (i = 0; i < num; i++) {
- hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
+ hda_nid_t nid = alc662_mix_to_dac(codec, srcs[i]);
if (!nid)
continue;
for (j = 0; j < spec->multiout.num_dacs; j++)
@@ -19297,7 +19298,7 @@ static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
if (num <= 1)
return;
for (i = 0; i < num; i++) {
- if (alc662_mix_to_dac(srcs[i]) != dac)
+ if (alc662_mix_to_dac(codec, srcs[i]) != dac)
continue;
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
return;