ASoC: fsl_sai: Use usleep_range() instead of msleep()
authorXiubo Li <lixiubo@cmss.chinamobile.com>
Fri, 15 Jan 2016 11:35:24 +0000 (19:35 +0800)
committerMark Brown <broonie@kernel.org>
Fri, 22 Jan 2016 16:47:52 +0000 (16:47 +0000)
Since msleep() will sleep longer than intended time for values less
than 20ms, this patch allows the use of usleep_range for just 1ms.
usleep_range is a finer precision implementation of msleep and is
designed to be a drop-in replacement for udelay where a precise
sleep/busy-wait is unnecessary.

More details see Documentation/timers/timers-howto.txt.

Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/fsl/fsl_sai.c

index 43ba5dc267754e449514310c36d2cb4c00092101..4919de9684eb8d10752ad2592534533e50e2e2e0 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/of_address.h>
 #include <linux/regmap.h>
 #include <linux/slab.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/dmaengine_pcm.h>
 #include <sound/pcm_params.h>
@@ -884,7 +885,7 @@ static int fsl_sai_resume(struct device *dev)
        regcache_cache_only(sai->regmap, false);
        regmap_write(sai->regmap, FSL_SAI_TCSR, FSL_SAI_CSR_SR);
        regmap_write(sai->regmap, FSL_SAI_RCSR, FSL_SAI_CSR_SR);
-       msleep(1);
+       usleep_range(1000, 2000);
        regmap_write(sai->regmap, FSL_SAI_TCSR, 0);
        regmap_write(sai->regmap, FSL_SAI_RCSR, 0);
        return regcache_sync(sai->regmap);
This page took 0.026162 seconds and 5 git commands to generate.