ALSA: ASoC: Check for exact register match in wm97xx_reset()
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 13 Jun 2008 15:24:04 +0000 (16:24 +0100)
committerJaroslav Kysela <perex@perex.cz>
Mon, 16 Jun 2008 07:32:27 +0000 (09:32 +0200)
To provide added robustness in case an AC97 controller reads back all
zeros in error cases check for an exact match when testing to see if
resets have brought the codec back.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
sound/soc/codecs/wm9712.c
sound/soc/codecs/wm9713.c

index 28ac66f6b6b234742c4464f36516c130d723695b..47390113bd0ef300805e2143969a39307a4035b4 100644 (file)
@@ -589,12 +589,12 @@ static int wm9712_reset(struct snd_soc_codec *codec, int try_warm)
 {
        if (try_warm && soc_ac97_ops.warm_reset) {
                soc_ac97_ops.warm_reset(codec->ac97);
-               if (!(ac97_read(codec, 0) & 0x8000))
+               if (ac97_read(codec, 0) == wm9712_reg[0])
                        return 1;
        }
 
        soc_ac97_ops.reset(codec->ac97);
-       if (ac97_read(codec, 0) & 0x8000)
+       if (ac97_read(codec, 0) != wm9712_reg[0])
                goto err;
        return 0;
 
index aba330118784ba7a50b55b93d77879d593f8d276..0db96374736933b52201e6f8b84bb5ed548f8df4 100644 (file)
@@ -1076,12 +1076,12 @@ int wm9713_reset(struct snd_soc_codec *codec, int try_warm)
 {
        if (try_warm && soc_ac97_ops.warm_reset) {
                soc_ac97_ops.warm_reset(codec->ac97);
-               if (!(ac97_read(codec, 0) & 0x8000))
+               if (ac97_read(codec, 0) == wm9713_reg[0])
                        return 1;
        }
 
        soc_ac97_ops.reset(codec->ac97);
-       if (ac97_read(codec, 0) & 0x8000)
+       if (ac97_read(codec, 0) != wm9713_reg[0])
                return -EIO;
        return 0;
 }