From f568291ef571522202e8b9f893ab33694bb2fc31 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Tue, 21 Feb 2012 12:37:00 +0100
Subject: [PATCH] ALSA: hda/realtek - Fix the wrong offset for two-speaker systems
Git-commit: f568291ef571522202e8b9f893ab33694bb2fc31
Patch-mainline: 3.4-rc3
References: FATE#314311

When the machine has two speakers but wants to put more multi-io
jacks, the parser shouldn't consider about the shared DAC but try to
assign the individual DACs.  Otherwise the channel mapping would be
fairly confused and lead to the wrong DACs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>

---
 sound/pci/hda/patch_realtek.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -3356,7 +3356,11 @@ static int fill_and_eval_dacs(struct hda
 	}
 	if (cfg->hp_outs && cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
 		/* try multi-ios with HP + inputs */
-		err = alc_auto_fill_multi_ios(codec, cfg->hp_pins[0], false, 1);
+		int offset = 0;
+		if (cfg->line_outs >= 3)
+			offset = 1;
+		err = alc_auto_fill_multi_ios(codec, cfg->hp_pins[0], false,
+					      offset);
 		if (err < 0)
 			return err;
 		badness += err;
