linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] ASoC: fsl: Use usleep_range() instead of msleep()
@ 2016-01-15 11:35 Xiubo Li
  2016-01-15 11:35 ` [PATCH 1/2] ASoC: fsl_sai: " Xiubo Li
  2016-01-15 11:35 ` [PATCH 2/2] ASoC: fsl-mpc5200: " Xiubo Li
  0 siblings, 2 replies; 4+ messages in thread
From: Xiubo Li @ 2016-01-15 11:35 UTC (permalink / raw)
  To: broonie; +Cc: alsa-devel, linux-kernel, Xiubo Li

Xiubo Li (2):
  ASoC: fsl_sai: Use usleep_range() instead of msleep()
  ASoC: fsl-mpc5200: Use usleep_range() instead of msleep()

 sound/soc/fsl/fsl_sai.c          | 3 ++-
 sound/soc/fsl/mpc5200_psc_ac97.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] ASoC: fsl_sai: Use usleep_range() instead of msleep()
  2016-01-15 11:35 [PATCH 0/2] ASoC: fsl: Use usleep_range() instead of msleep() Xiubo Li
@ 2016-01-15 11:35 ` Xiubo Li
  2016-01-22 16:48   ` Mark Brown
  2016-01-15 11:35 ` [PATCH 2/2] ASoC: fsl-mpc5200: " Xiubo Li
  1 sibling, 1 reply; 4+ messages in thread
From: Xiubo Li @ 2016-01-15 11:35 UTC (permalink / raw)
  To: broonie; +Cc: alsa-devel, linux-kernel, Xiubo Li

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>
---
 sound/soc/fsl/fsl_sai.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index fef264d..0754df7 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -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>
@@ -919,7 +920,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);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] ASoC: fsl-mpc5200: Use usleep_range() instead of msleep()
  2016-01-15 11:35 [PATCH 0/2] ASoC: fsl: Use usleep_range() instead of msleep() Xiubo Li
  2016-01-15 11:35 ` [PATCH 1/2] ASoC: fsl_sai: " Xiubo Li
@ 2016-01-15 11:35 ` Xiubo Li
  1 sibling, 0 replies; 4+ messages in thread
From: Xiubo Li @ 2016-01-15 11:35 UTC (permalink / raw)
  To: broonie; +Cc: alsa-devel, linux-kernel, Xiubo Li

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>
---
 sound/soc/fsl/mpc5200_psc_ac97.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index 0bab760..243700c 100644
--- a/sound/soc/fsl/mpc5200_psc_ac97.c
+++ b/sound/soc/fsl/mpc5200_psc_ac97.c
@@ -13,6 +13,7 @@
 #include <linux/of_device.h>
 #include <linux/of_platform.h>
 #include <linux/delay.h>
+#include <linux/time.h>
 
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
@@ -127,7 +128,7 @@ static void psc_ac97_cold_reset(struct snd_ac97 *ac97)
 
 	mutex_unlock(&psc_dma->mutex);
 
-	msleep(1);
+	usleep_range(1000, 2000);
 	psc_ac97_warm_reset(ac97);
 }
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] ASoC: fsl_sai: Use usleep_range() instead of msleep()
  2016-01-15 11:35 ` [PATCH 1/2] ASoC: fsl_sai: " Xiubo Li
@ 2016-01-22 16:48   ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2016-01-22 16:48 UTC (permalink / raw)
  To: Xiubo Li; +Cc: alsa-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 419 bytes --]

On Fri, Jan 15, 2016 at 07:35:24PM +0800, Xiubo Li wrote:
> 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.

A similar change seems to have already been applied.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-01-22 16:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-15 11:35 [PATCH 0/2] ASoC: fsl: Use usleep_range() instead of msleep() Xiubo Li
2016-01-15 11:35 ` [PATCH 1/2] ASoC: fsl_sai: " Xiubo Li
2016-01-22 16:48   ` Mark Brown
2016-01-15 11:35 ` [PATCH 2/2] ASoC: fsl-mpc5200: " Xiubo Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).