提交 abb68c26 编写于 作者: M Mark Brown 提交者: Jaroslav Kysela

ALSA: ASoC: Check for exact register match in wm97xx_reset()

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: NMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
Signed-off-by: NJaroslav Kysela <perex@perex.cz>
上级 aafc4412
...@@ -589,12 +589,12 @@ static int wm9712_reset(struct snd_soc_codec *codec, int try_warm) ...@@ -589,12 +589,12 @@ static int wm9712_reset(struct snd_soc_codec *codec, int try_warm)
{ {
if (try_warm && soc_ac97_ops.warm_reset) { if (try_warm && soc_ac97_ops.warm_reset) {
soc_ac97_ops.warm_reset(codec->ac97); soc_ac97_ops.warm_reset(codec->ac97);
if (!(ac97_read(codec, 0) & 0x8000)) if (ac97_read(codec, 0) == wm9712_reg[0])
return 1; return 1;
} }
soc_ac97_ops.reset(codec->ac97); soc_ac97_ops.reset(codec->ac97);
if (ac97_read(codec, 0) & 0x8000) if (ac97_read(codec, 0) != wm9712_reg[0])
goto err; goto err;
return 0; return 0;
......
...@@ -1076,12 +1076,12 @@ int wm9713_reset(struct snd_soc_codec *codec, int try_warm) ...@@ -1076,12 +1076,12 @@ int wm9713_reset(struct snd_soc_codec *codec, int try_warm)
{ {
if (try_warm && soc_ac97_ops.warm_reset) { if (try_warm && soc_ac97_ops.warm_reset) {
soc_ac97_ops.warm_reset(codec->ac97); soc_ac97_ops.warm_reset(codec->ac97);
if (!(ac97_read(codec, 0) & 0x8000)) if (ac97_read(codec, 0) == wm9713_reg[0])
return 1; return 1;
} }
soc_ac97_ops.reset(codec->ac97); soc_ac97_ops.reset(codec->ac97);
if (ac97_read(codec, 0) & 0x8000) if (ac97_read(codec, 0) != wm9713_reg[0])
return -EIO; return -EIO;
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册