summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorNicolin Chen <b42378@freescale.com>2013-11-26 15:08:41 +0800
committerNicolin Chen <b42378@freescale.com>2013-11-27 19:35:38 +0800
commita1238fa0fe2de5ccfa0b271537bb14dfd07815b1 (patch)
treea3dd8e9f464894f5b1c5c78f50b9adc11521a4a7 /sound
parente0790fbed4bc0e8897ebdacaad62e39e6855506e (diff)
ENGR00289643-2 ASoC: fsl: Add missing spba clock for esai and spdif
Both esai and spdif are using SDMA script to transmit and receive data while the essential spba clock is missed in the current two drivers. Thus add them. Acked-by: Wang Shengjiu <b02247@freescale.com> Signed-off-by: Nicolin Chen <b42378@freescale.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/fsl/fsl_esai.c11
-rw-r--r--sound/soc/fsl/fsl_esai.h1
-rw-r--r--sound/soc/fsl/fsl_spdif.c10
3 files changed, 21 insertions, 1 deletions
diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index 221b4e49ed60..72165238e4ac 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -294,6 +294,7 @@ static int fsl_esai_startup(struct snd_pcm_substream *substream,
struct fsl_esai *esai = snd_soc_dai_get_drvdata(cpu_dai);
clk_enable(esai->clk);
+ clk_prepare_enable(esai->dmaclk);
if (!cpu_dai->active) {
writel(ESAI_GPIO_ESAI, esai->base + ESAI_PRRC);
writel(ESAI_GPIO_ESAI, esai->base + ESAI_PCRC);
@@ -438,6 +439,7 @@ static void fsl_esai_shutdown(struct snd_pcm_substream *substream,
{
struct fsl_esai *esai = snd_soc_dai_get_drvdata(cpu_dai);
+ clk_disable_unprepare(esai->dmaclk);
clk_disable(esai->clk);
}
@@ -576,7 +578,7 @@ static int fsl_esai_probe(struct platform_device *pdev)
}
esai->flags = flag;
- esai->clk = devm_clk_get(&pdev->dev, NULL);
+ esai->clk = devm_clk_get(&pdev->dev, "core");
if (IS_ERR(esai->clk)) {
ret = PTR_ERR(esai->clk);
dev_err(&pdev->dev, "Cannot get the clock: %d\n", ret);
@@ -584,6 +586,13 @@ static int fsl_esai_probe(struct platform_device *pdev)
}
clk_prepare(esai->clk);
+ esai->dmaclk = devm_clk_get(&pdev->dev, "dma");
+ if (IS_ERR(esai->dmaclk)) {
+ ret = PTR_ERR(esai->dmaclk);
+ dev_err(&pdev->dev, "Cannot get dma clock: %d\n", ret);
+ goto failed_get_resource;
+ }
+
ret = of_address_to_resource(np, 0, &res);
if (ret) {
dev_err(&pdev->dev, "could not determine device resources\n");
diff --git a/sound/soc/fsl/fsl_esai.h b/sound/soc/fsl/fsl_esai.h
index 32ff624af860..f0b6198a69a6 100644
--- a/sound/soc/fsl/fsl_esai.h
+++ b/sound/soc/fsl/fsl_esai.h
@@ -318,6 +318,7 @@
struct fsl_esai {
struct clk *clk;
+ struct clk *dmaclk;
void __iomem *base;
int irq;
unsigned int flags;
diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c
index 10e5c7568c4e..99480fe77f4f 100644
--- a/sound/soc/fsl/fsl_spdif.c
+++ b/sound/soc/fsl/fsl_spdif.c
@@ -83,6 +83,7 @@ struct fsl_spdif_priv {
struct clk *txclk[SPDIF_TXRATE_MAX];
struct clk *rxclk;
struct clk *sysclk;
+ struct clk *dmaclk;
struct snd_dmaengine_dai_dma_data dma_params_tx;
struct snd_dmaengine_dai_dma_data dma_params_rx;
@@ -425,6 +426,7 @@ static int fsl_spdif_startup(struct snd_pcm_substream *substream,
int ret;
pm_runtime_get_sync(cpu_dai->dev);
+ clk_prepare_enable(spdif_priv->dmaclk);
/* Reset module and interrupts only for first initialization */
if (!cpu_dai->active) {
@@ -491,6 +493,7 @@ static void fsl_spdif_shutdown(struct snd_pcm_substream *substream,
SCR_LOW_POWER, SCR_LOW_POWER);
}
+ clk_disable_unprepare(spdif_priv->dmaclk);
pm_runtime_put_sync(cpu_dai->dev);
}
@@ -1159,6 +1162,13 @@ static int fsl_spdif_probe(struct platform_device *pdev)
return PTR_ERR(spdif_priv->sysclk);
}
+ /* Get dma clock for dma script operation */
+ spdif_priv->dmaclk = devm_clk_get(&pdev->dev, "dma");
+ if (IS_ERR(spdif_priv->dmaclk)) {
+ dev_err(&pdev->dev, "no dma clock in devicetree\n");
+ return PTR_ERR(spdif_priv->dmaclk);
+ }
+
/* Select clock source for rx/tx clock */
spdif_priv->rxclk = devm_clk_get(&pdev->dev, "rxtx1");
if (IS_ERR(spdif_priv->rxclk)) {