Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 512feb4e authored by Xiubo Li's avatar Xiubo Li Committed by Mark Brown
Browse files

ASoC: fsl_sai: Use usleep_range() instead of msleep()



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: default avatarXiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent c1df2964
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
#include <linux/of_address.h>
#include <linux/of_address.h>
#include <linux/regmap.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/time.h>
#include <sound/core.h>
#include <sound/core.h>
#include <sound/dmaengine_pcm.h>
#include <sound/dmaengine_pcm.h>
#include <sound/pcm_params.h>
#include <sound/pcm_params.h>
@@ -884,7 +885,7 @@ static int fsl_sai_resume(struct device *dev)
	regcache_cache_only(sai->regmap, false);
	regcache_cache_only(sai->regmap, false);
	regmap_write(sai->regmap, FSL_SAI_TCSR, FSL_SAI_CSR_SR);
	regmap_write(sai->regmap, FSL_SAI_TCSR, FSL_SAI_CSR_SR);
	regmap_write(sai->regmap, FSL_SAI_RCSR, 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_TCSR, 0);
	regmap_write(sai->regmap, FSL_SAI_RCSR, 0);
	regmap_write(sai->regmap, FSL_SAI_RCSR, 0);
	return regcache_sync(sai->regmap);
	return regcache_sync(sai->regmap);