From 4f2864a49bf058184e85c9f5a2f4578f11992c7d Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Wed, 25 Jan 2012 11:54:19 +0100
Subject: [PATCH] ALSA: hda - Enable sync_write and reset for Conexant codecs
Git-commit: 4f2864a49bf058184e85c9f5a2f4578f11992c7d
Patch-mainline: 3.4-rc3
References: FATE#313695

This is an attempt to fix S3-resume problems reported for a few
laptops with different Conexant codecs.  They show the communication
stalls at some time in S3, and the driver falls back into the
single-cmd mode.  This leads to the silent output or the lack of
auto-mute feature.

As a workaround, here enables the sync_write and the bus-reset flags
to make the communication more stable.

Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=740115
Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=738397

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

---
 sound/pci/hda/patch_conexant.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -4450,6 +4450,18 @@ static int patch_conexant_auto(struct hd
 	codec->patch_ops = cx_auto_patch_ops;
 	if (spec->beep_amp)
 		snd_hda_attach_beep_device(codec, spec->beep_amp);
+
+	/* Some laptops with Conexant chips show stalls in S3 resume,
+	 * which falls into the single-cmd mode.
+	 * Better to make reset, then.
+	 */
+	if (!codec->bus->sync_write) {
+		snd_printd("hda_codec: "
+			   "Enable sync_write for stable communication\n");
+		codec->bus->sync_write = 1;
+		codec->bus->allow_bus_reset = 1;
+	}
+
 	return 0;
 }
 
