From 47616d22f8f303dfd66cf3b9125af212194a0f3c Mon Sep 17 00:00:00 2001 From: Dmitry Baryshkov Date: Wed, 9 Jan 2008 02:08:17 +0300 Subject: [PATCH 53/64] sound/soc/codecs/wm9712.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) Index: git/sound/soc/codecs/wm9712.c =================================================================== --- sound/soc/codecs/wm9712.c | 28 ++++++++++++++++++---------- 1 files changed, 18 insertions(+), 10 deletions(-) diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c index 986b5d5..dfb31e1 100644 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c @@ -606,18 +606,26 @@ static int wm9712_dapm_event(struct snd_soc_codec *codec, int event) 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)) - return 1; - } + int retry = 3; - soc_ac97_ops.reset(codec->ac97); - if (ac97_read(codec, 0) & 0x8000) - goto err; - return 0; + while (retry--) + { + if(try_warm && soc_ac97_ops.warm_reset) { + soc_ac97_ops.warm_reset(codec->ac97); + if(ac97_read(codec, 0) & 0x8000) + continue; + else + return 1; + } + + soc_ac97_ops.reset(codec->ac97); + if(ac97_read(codec, 0) & 0x8000) + continue; + else + return 0; + + } -err: printk(KERN_ERR "WM9712 AC97 reset failed\n"); return -EIO; } -- 1.5.3.8