[ALSA] hda-intel - Improve HD-audio codec probing robustness
authorDanny Tholen <obiwan@mailmij.org>
Tue, 11 Sep 2007 19:41:56 +0000 (21:41 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 16 Oct 2007 14:50:20 +0000 (16:50 +0200)
When modem is disabled in the BIOS, detection of the number of codecs
always fails after booting if STATESTS is not cleared first.
This patch fixes this problem and also adds an error check in a place
where a read error would lead to a very large number of pointless loops.

Signed-off-by: Danny Tholen <obiwan@mailmij.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_intel.c

index e594de0..535bcb7 100644 (file)
@@ -155,6 +155,8 @@ int snd_hda_get_sub_nodes(struct hda_codec *codec, hda_nid_t nid,
        unsigned int parm;
 
        parm = snd_hda_param_read(codec, nid, AC_PAR_NODE_COUNT);
+       if (parm == -1)
+               return 0;
        *start_id = (parm >> 16) & 0x7fff;
        return (int)(parm & 0x7fff);
 }
index 72fd345..68dc9a2 100644 (file)
@@ -687,6 +687,9 @@ static int azx_reset(struct azx *chip)
 {
        int count;
 
+       /* clear STATESTS */
+       azx_writeb(chip, STATESTS, STATESTS_INT_MASK);
+
        /* reset controller */
        azx_writel(chip, GCTL, azx_readl(chip, GCTL) & ~ICH6_GCTL_RESET);