merge of 425cf1b391611c169a1c3b78f1fe86df088902b9
[vuplus_openembedded] / packages / linux / linux-rp-2.6.18+git / wm9712-reset-loop-r2.patch
1  sound/soc/codecs/wm9712.c |   28 ++++++++++++++++++----------
2  1 file changed, 18 insertions(+), 10 deletions(-)
3
4 Index: git/sound/soc/codecs/wm9712.c
5 ===================================================================
6 --- git.orig/sound/soc/codecs/wm9712.c  2006-11-07 22:10:01.000000000 +0000
7 +++ git/sound/soc/codecs/wm9712.c       2006-11-07 22:11:50.000000000 +0000
8 @@ -618,18 +618,26 @@ static int wm9712_dapm_event(struct snd_
9  
10  static int wm9712_reset(struct snd_soc_codec *codec, int try_warm)
11  {
12 -       if (try_warm && soc_ac97_ops.warm_reset) {
13 -               soc_ac97_ops.warm_reset(codec->ac97);
14 -               if (!(ac97_read(codec, 0) & 0x8000))
15 -                       return 1;
16 -       }
17 +       int retry = 3;
18  
19 -       soc_ac97_ops.reset(codec->ac97);
20 -       if (ac97_read(codec, 0) & 0x8000)
21 -               goto err;
22 -       return 0;
23 +       while (retry--)
24 +       {
25 +               if(try_warm && soc_ac97_ops.warm_reset) {
26 +                       soc_ac97_ops.warm_reset(codec->ac97);
27 +                       if(ac97_read(codec, 0) & 0x8000)
28 +                               continue;
29 +                       else
30 +                               return 1;
31 +               }
32 +
33 +               soc_ac97_ops.reset(codec->ac97);
34 +               if(ac97_read(codec, 0) & 0x8000)
35 +                       continue;
36 +               else
37 +                       return 0;
38 +
39 +       }
40  
41 -err:
42         printk(KERN_ERR "WM9712 AC97 reset failed\n");
43         return -EIO;
44  }