Skip to content

Commit

Permalink
ASoC: nuc900: fix a wait loop bug
Browse files Browse the repository at this point in the history
The current implement meant ACTL_ACCON was only accessed once when read or write
proceeding, which is not right, if so,we have to wait the 'timeout=0x10000' to end
every times.

We need to polling the bit AC_R_FINISH and AC_W_FINISH of ACTL_ACCON
register to identify whether read or write is finished or not,so I make
the patch to fix the issue.

Signed-off-by: Wan ZongShun <mcuos.com@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Wan ZongShun authored and Mark Brown committed Jun 2, 2010
1 parent 018334c commit 8dfb0c7
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions sound/soc/nuc900/nuc900-ac97.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ static unsigned short nuc900_ac97_read(struct snd_ac97 *ac97,
udelay(100);

/* polling the AC_R_FINISH */
val = AUDIO_READ(nuc900_audio->mmio + ACTL_ACCON);
val &= AC_R_FINISH;
while (!val && timeout--)
while (!(AUDIO_READ(nuc900_audio->mmio + ACTL_ACCON) & AC_R_FINISH)
&& timeout--)
mdelay(1);

if (!timeout) {
Expand Down Expand Up @@ -121,9 +120,8 @@ static void nuc900_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
udelay(100);

/* polling the AC_W_FINISH */
tmp = AUDIO_READ(nuc900_audio->mmio + ACTL_ACCON);
tmp &= AC_W_FINISH;
while (tmp && timeout--)
while ((AUDIO_READ(nuc900_audio->mmio + ACTL_ACCON) & AC_W_FINISH)
&& timeout--)
mdelay(1);

if (!timeout)
Expand Down

0 comments on commit 8dfb0c7

Please sign in to comment.