diff options
author | Nicolin Chen <Guangyu.Chen@freescale.com> | 2014-04-18 06:01:05 -0400 |
---|---|---|
committer | Nicolin Chen <Guangyu.Chen@freescale.com> | 2014-04-21 23:57:53 -0400 |
commit | 7e9a6bb3eb4df21f96a6f3efd1f3a334a910b2ac (patch) | |
tree | d51314e12b5172717ba5bbad32f27c64fa69482b /sound/soc/fsl | |
parent | 72701dcad5956ba5fe79e78b37ba74fc08414b67 (diff) |
ENGR00309468-1 ASoC: fsl_spdif: Add coreclk control for DMA access
Even if we assign regmap to manage the coreclk control, we still need
to open the clock if we are going to run the driver because DMA access
would not be detected by regmap.
So this patch adds clock control for coreclk.
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Diffstat (limited to 'sound/soc/fsl')
-rw-r--r-- | sound/soc/fsl/fsl_spdif.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c index 99480fe77f4f..4f42bb7ea6a4 100644 --- a/sound/soc/fsl/fsl_spdif.c +++ b/sound/soc/fsl/fsl_spdif.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Freescale S/PDIF ALSA SoC Digital Audio Interface (DAI) driver | 2 | * Freescale S/PDIF ALSA SoC Digital Audio Interface (DAI) driver |
3 | * | 3 | * |
4 | * Copyright (C) 2013 Freescale Semiconductor, Inc. | 4 | * Copyright (C) 2013-2014 Freescale Semiconductor, Inc. |
5 | * | 5 | * |
6 | * Based on stmp3xxx_spdif_dai.c | 6 | * Based on stmp3xxx_spdif_dai.c |
7 | * Vladimir Barinov <vbarinov@embeddedalley.com> | 7 | * Vladimir Barinov <vbarinov@embeddedalley.com> |
@@ -82,6 +82,7 @@ struct fsl_spdif_priv { | |||
82 | u8 rxclk_src; | 82 | u8 rxclk_src; |
83 | struct clk *txclk[SPDIF_TXRATE_MAX]; | 83 | struct clk *txclk[SPDIF_TXRATE_MAX]; |
84 | struct clk *rxclk; | 84 | struct clk *rxclk; |
85 | struct clk *coreclk; | ||
85 | struct clk *sysclk; | 86 | struct clk *sysclk; |
86 | struct clk *dmaclk; | 87 | struct clk *dmaclk; |
87 | struct snd_dmaengine_dai_dma_data dma_params_tx; | 88 | struct snd_dmaengine_dai_dma_data dma_params_tx; |
@@ -426,6 +427,7 @@ static int fsl_spdif_startup(struct snd_pcm_substream *substream, | |||
426 | int ret; | 427 | int ret; |
427 | 428 | ||
428 | pm_runtime_get_sync(cpu_dai->dev); | 429 | pm_runtime_get_sync(cpu_dai->dev); |
430 | clk_prepare_enable(spdif_priv->coreclk); | ||
429 | clk_prepare_enable(spdif_priv->dmaclk); | 431 | clk_prepare_enable(spdif_priv->dmaclk); |
430 | 432 | ||
431 | /* Reset module and interrupts only for first initialization */ | 433 | /* Reset module and interrupts only for first initialization */ |
@@ -494,6 +496,7 @@ static void fsl_spdif_shutdown(struct snd_pcm_substream *substream, | |||
494 | } | 496 | } |
495 | 497 | ||
496 | clk_disable_unprepare(spdif_priv->dmaclk); | 498 | clk_disable_unprepare(spdif_priv->dmaclk); |
499 | clk_disable_unprepare(spdif_priv->coreclk); | ||
497 | pm_runtime_put_sync(cpu_dai->dev); | 500 | pm_runtime_put_sync(cpu_dai->dev); |
498 | } | 501 | } |
499 | 502 | ||
@@ -1162,6 +1165,13 @@ static int fsl_spdif_probe(struct platform_device *pdev) | |||
1162 | return PTR_ERR(spdif_priv->sysclk); | 1165 | return PTR_ERR(spdif_priv->sysclk); |
1163 | } | 1166 | } |
1164 | 1167 | ||
1168 | /* Get core clock for data register access via DMA */ | ||
1169 | spdif_priv->coreclk = devm_clk_get(&pdev->dev, "core"); | ||
1170 | if (IS_ERR(spdif_priv->coreclk)) { | ||
1171 | dev_err(&pdev->dev, "no core clock in devicetree\n"); | ||
1172 | return PTR_ERR(spdif_priv->coreclk); | ||
1173 | } | ||
1174 | |||
1165 | /* Get dma clock for dma script operation */ | 1175 | /* Get dma clock for dma script operation */ |
1166 | spdif_priv->dmaclk = devm_clk_get(&pdev->dev, "dma"); | 1176 | spdif_priv->dmaclk = devm_clk_get(&pdev->dev, "dma"); |
1167 | if (IS_ERR(spdif_priv->dmaclk)) { | 1177 | if (IS_ERR(spdif_priv->dmaclk)) { |