Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Mark Brown <broonie <at> opensource.wolfsonmicro.com>
Subject: [PATCH 1/2] soc - Fix s3c24xx-i2s LR sync while timer ticks are disabled
Newsgroups: gmane.linux.alsa.devel
Date: Monday 14th April 2008 11:01:42 UTC (over 9 years ago)
From: Werner Almesberger <[email protected]>

When timer ticks are disabled when calling
sound/soc/s3c24xx/s3c24xx-i2s.c:s3c24xx_snd_lrsync
and the LR signal never happens, we loop forever.

This has been observed in the following call chain:
snd_pcm_common_ioctl1 -> snd_pcm_action_lock_irq ->
snd_pcm_action_single
  -> snd_pcm_do_resume -> soc_pcm_trigger -> s3c24xx_i2s_trigger

The patch below changes the timeout mechanism to use udelay, which
doesn't need timer ticks.

Signed-off-by: Werner Almesberger <[email protected]>
Signed-off-by: Mark Brown 
---
 sound/soc/s3c24xx/s3c24xx-i2s.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/sound/soc/s3c24xx/s3c24xx-i2s.c
b/sound/soc/s3c24xx/s3c24xx-i2s.c
index 0a3c630..6b3cbbf 100644
--- a/sound/soc/s3c24xx/s3c24xx-i2s.c
+++ b/sound/soc/s3c24xx/s3c24xx-i2s.c
@@ -180,7 +180,7 @@ static void s3c24xx_snd_rxctrl(int on)
 static int s3c24xx_snd_lrsync(void)
 {
 	u32 iiscon;
-	unsigned long timeout = jiffies + msecs_to_jiffies(5);
+	int timeout = 50; /* 5ms */
 
 	DBG("Entered %s\n", __FUNCTION__);
 
@@ -189,8 +189,9 @@ static int s3c24xx_snd_lrsync(void)
 		if (iiscon & S3C2410_IISCON_LRINDEX)
 			break;
 
-		if (time_after(jiffies, timeout))
+		if (!timeout--)
 			return -ETIMEDOUT;
+		udelay(100);
 	}
 
 	return 0;
-- 
1.5.5
 
CD: 3ms