Skip to content

Commit

Permalink
ALSA: ASoC: Check for exact register match in wm97xx_reset()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mark Brown authored and Jaroslav Kysela committed Jun 16, 2008
1 parent aafc441 commit abb68c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions sound/soc/codecs/wm9712.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions sound/soc/codecs/wm9713.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit abb68c2

Please sign in to comment.