[alsa-devel] [PATCH] ASoC: fsi: fsi_set_master_clk() was called from fsi_hw_xxx() only

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Mon Oct 29 08:37:22 CET 2012


Current FSI driver is using fsi_set_master_clk() if it needs system clock.
But this function was called from
fsi_hw_shutdown()/fsi_dai_trigger()/fsi_resume() without a sense of unity.
Because of this, sound playback after suspend failed sometimes.
To keep consistency, fsi_master_clk() was called from
fsi_hw_start/stop() only now.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
 sound/soc/sh/fsi.c |   23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index a33d483..e97501b 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -1364,12 +1364,17 @@ static int fsi_hw_startup(struct fsi_priv *fsi,
 	/* fifo init */
 	fsi_fifo_init(fsi, io, dev);
 
+	/* start master clock */
+	if (fsi_is_clk_master(fsi))
+		fsi_set_master_clk(dev, fsi, fsi->rate, 1);
+
 	return 0;
 }
 
 static void fsi_hw_shutdown(struct fsi_priv *fsi,
 			    struct device *dev)
 {
+	/* stop master clock */
 	if (fsi_is_clk_master(fsi))
 		fsi_set_master_clk(dev, fsi, fsi->rate, 0);
 }
@@ -1492,19 +1497,11 @@ static int fsi_dai_hw_params(struct snd_pcm_substream *substream,
 			     struct snd_soc_dai *dai)
 {
 	struct fsi_priv *fsi = fsi_get_priv(substream);
-	long rate = params_rate(params);
-	int ret;
-
-	if (!fsi_is_clk_master(fsi))
-		return 0;
-
-	ret = fsi_set_master_clk(dai->dev, fsi, rate, 1);
-	if (ret < 0)
-		return ret;
 
-	fsi->rate = rate;
+	if (fsi_is_clk_master(fsi))
+		fsi->rate = params_rate(params);
 
-	return ret;
+	return 0;
 }
 
 static const struct snd_soc_dai_ops fsi_dai_ops = {
@@ -1806,10 +1803,6 @@ static void __fsi_resume(struct fsi_priv *fsi,
 		return;
 
 	fsi_hw_startup(fsi, io, dev);
-
-	if (fsi_is_clk_master(fsi) && fsi->rate)
-		fsi_set_master_clk(dev, fsi, fsi->rate, 1);
-
 	fsi_stream_start(fsi, io);
 }
 
-- 
1.7.9.5



More information about the Alsa-devel mailing list