[ALSA] hda-intel - Add workarounds for STAC codecs
authorTakashi Iwai <tiwai@suse.de>
Wed, 16 Jan 2008 15:09:47 +0000 (16:09 +0100)
committerJaroslav Kysela <perex@perex.cz>
Thu, 31 Jan 2008 16:30:02 +0000 (17:30 +0100)
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
sound/pci/hda/hda_intel.c
sound/pci/hda/patch_sigmatel.c

index 20be7761562d4b674fd8cb2e255954d6a85efe32..719e46f6fb36dfd316ef4e93e32ebe5bdaadb859 100644 (file)
@@ -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;
 };
 
 /*
index 5f2c3ca863db18b8691115a65518bb86bc854c48..fe07bdff60d015064463dc020573e384446c3143 100644 (file)
@@ -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) {
index 1d643b9771a078f3e671a019f0115e2a9f7d4e57..24137bc975c435efa212a8022294151a95332e2a 100644 (file)
@@ -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;
 }