aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXiubo Li <Li.Xiubo@freescale.com>2013-12-24 22:20:14 -0500
committerMark Brown <broonie@linaro.org>2013-12-30 07:00:56 -0500
commite6dc12d7198eddba2e3e7a13feab5c7edde7ba1d (patch)
tree0caa2620728565c9cbec51b2b2068445ebf36f99
parent4e3a99f5b004b30bc604d82e5498700649148e0d (diff)
ASoC: fsl_sai: Move the global registers setting to _dai_probe()
Because we cannot make sure which one of _dai_fmt() and _dai_sysclk() will be firstly called. So move the RCSR/TCSR and TCR1/RCR1's initialization to _dai_probe(), and this can make sure that before any of {T,R}CR{1~5} register to be set the RCSR/TCSR's RE/TE bit has been cleared for the hareware limitation. Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--sound/soc/fsl/fsl_sai.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index b72132fa70de..596aabbf9037 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -100,11 +100,6 @@ static int fsl_sai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
100 if (ret) 100 if (ret)
101 return ret; 101 return ret;
102 102
103 sai_writel(sai, 0x0, sai->base + FSL_SAI_RCSR);
104 sai_writel(sai, 0x0, sai->base + FSL_SAI_TCSR);
105 sai_writel(sai, FSL_SAI_MAXBURST_TX * 2, sai->base + FSL_SAI_TCR1);
106 sai_writel(sai, FSL_SAI_MAXBURST_RX - 1, sai->base + FSL_SAI_RCR1);
107
108 ret = fsl_sai_set_dai_sysclk_tr(cpu_dai, clk_id, freq, 103 ret = fsl_sai_set_dai_sysclk_tr(cpu_dai, clk_id, freq,
109 FSL_FMT_TRANSMITTER); 104 FSL_FMT_TRANSMITTER);
110 if (ret) { 105 if (ret) {
@@ -351,6 +346,18 @@ static const struct snd_soc_dai_ops fsl_sai_pcm_dai_ops = {
351static int fsl_sai_dai_probe(struct snd_soc_dai *cpu_dai) 346static int fsl_sai_dai_probe(struct snd_soc_dai *cpu_dai)
352{ 347{
353 struct fsl_sai *sai = dev_get_drvdata(cpu_dai->dev); 348 struct fsl_sai *sai = dev_get_drvdata(cpu_dai->dev);
349 int ret;
350
351 ret = clk_prepare_enable(sai->clk);
352 if (ret)
353 return ret;
354
355 sai_writel(sai, 0x0, sai->base + FSL_SAI_RCSR);
356 sai_writel(sai, 0x0, sai->base + FSL_SAI_TCSR);
357 sai_writel(sai, FSL_SAI_MAXBURST_TX * 2, sai->base + FSL_SAI_TCR1);
358 sai_writel(sai, FSL_SAI_MAXBURST_RX - 1, sai->base + FSL_SAI_RCR1);
359
360 clk_disable_unprepare(sai->clk);
354 361
355 snd_soc_dai_init_dma_data(cpu_dai, &sai->dma_params_tx, 362 snd_soc_dai_init_dma_data(cpu_dai, &sai->dma_params_tx,
356 &sai->dma_params_rx); 363 &sai->dma_params_rx);