From 06503670afc4372186d691ab2b9298a5e86fa29f Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Thu, 6 Oct 2011 08:27:19 +0200
Subject: [PATCH] ALSA: hda/realtek - Choose more cleverly the primary outputs
Git-commit: 06503670afc4372186d691ab2b9298a5e86fa29f
Patch-mainline: 3.2-rc1
References: FATE#314311

When the speaker outputs are more than the headphone outputs, it implies
that the system has surround speakers while the headphones are only for
monitoring the front.  In such a case, it's better to put speakers as
the primary outputs so that the driver can build up and keep the
surround setup.  Otherwise the system will pick up the headphone as
primary, and offers less channels than the speakers do support.

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

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

--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -3735,7 +3735,8 @@ static int alc_parse_auto_config(struct
 		return 0; /* can't find valid BIOS pin config */
 	}
 
-	if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT && cfg->hp_outs > 0) {
+	if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT &&
+	    cfg->line_outs <= cfg->hp_outs) {
 		/* use HP as primary out */
 		cfg->speaker_outs = cfg->line_outs;
 		memcpy(cfg->speaker_pins, cfg->line_out_pins,
