[ALSA] hda-intel - Add workarounds for STAC codecs

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, January 31, 2008 - 5:03 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=529876...
Commit:     52987656fb3d43192639a7d585feb564c075c864
Parent:     192b8e3922c916cbacac7e5a190d9412ae39a7ee
Author:     Takashi Iwai <tiwai@suse.de>
AuthorDate: Wed Jan 16 16:09:47 2008 +0100
Committer:  Jaroslav Kysela <perex@perex.cz>
CommitDate: Thu Jan 31 17:30:02 2008 +0100

    [ALSA] hda-intel - Add workarounds for STAC codecs
    
    Some machines with STAC codecs seem to have problems (e.g. no audible
    playback) when the delay in codec-read routine is too short.
    I still don't figure out which command sequence causes this problem
    (due to lack of test hardware), but it's known that increasing the
    delay fixes.  So, added a stupid workaround here temporarily...
    
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
 sound/pci/hda/hda_codec.h      |    3 +++
 sound/pci/hda/hda_intel.c      |    8 ++++++--
 sound/pci/hda/patch_sigmatel.c |   12 ++++++++++++
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 20be776..719e46f 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -464,6 +464,9 @@ struct hda_bus {
 	struct hda_bus_unsolicited *unsol;
 
 	struct snd_info_entry *proc;
+
+	/* misc op flags */
+	unsigned int needs_damn_long_delay :1;
 };
 
 /*
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 5f2c3ca..fe07bdf 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -559,8 +559,12 @@ static unsigned int azx_rirb_get_response(struct hda_codec *codec)
 		}
 		if (!chip->rirb.cmds)
 			return chip->rirb.res; /* the last value */
-		udelay(10);
-		cond_resched();
+		if (codec->bus->needs_damn_long_delay)
+			msleep(2); /* temporary workaround */
+		else {
+			udelay(10);
+			cond_resched();
+		}
 	} while (time_after_eq(timeout, jiffies));
 
 	if (chip->msi) {
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 1d643b9..24137bc 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -3472,6 +3472,18 @@ static int patch_stac927x(struct hda_codec *codec)
 
 	codec->patch_ops = stac92xx_patch_ops;
 
+	/*
+	 * !!FIXME!!
+	 * The STAC927x seem to require fairly long delays for certain
+	 * command sequences.  With too short delays (even if the answer
+	 * is set to RIRB properly), it results in the silence output
+	 * on some hardwares like Dell.
+	 *
+	 * The below flag enables the longer delay (see get_response
+	 * in hda_intel.c).
+	 */
+	codec->bus->needs_damn_long_delay = 1;
+
 	return 0;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[ALSA] hda-intel - Add workarounds for STAC codecs, Linux Kernel Mailing ..., (Thu Jan 31, 5:03 pm)