diff options
author | Adrian Alonso <aalonso@freescale.com> | 2012-04-25 18:05:44 -0500 |
---|---|---|
committer | Jason Liu <r64343@freescale.com> | 2012-07-20 13:36:41 +0800 |
commit | 3057539df97d8fa84848ed2ad13c1d2dc88d101e (patch) | |
tree | 9c86734192800efa2f0a5617d9d68dbf4451ab9f /sound | |
parent | fa80f2ae8179214e0e7210815a2974a47d7b9daa (diff) |
ENGR00180236-2: spdif clk usecount is 1 when not in use
* Move spdif_core_clk enable from spdif_probe to spdif_startup
function in order to avoid initializing the core clock
when module is not in use.
* At spdif_shutdown disable spdif core_clk.
Signed-off-by: Adrian Alonso <aalonso@freescale.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/mxc_spdif.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/sound/soc/codecs/mxc_spdif.c b/sound/soc/codecs/mxc_spdif.c index 9a538c7295af..2bcb4d68274b 100644 --- a/sound/soc/codecs/mxc_spdif.c +++ b/sound/soc/codecs/mxc_spdif.c @@ -1055,8 +1055,17 @@ static struct snd_kcontrol_new mxc_spdif_ctrls[] = { static int mxc_spdif_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { + struct snd_soc_codec *codec = dai->codec; + struct mxc_spdif_priv *spdif_priv = snd_soc_codec_get_drvdata(codec); + struct mxc_spdif_platform_data *plat_data = spdif_priv->plat_data; int ret; + /* enable spdif_xtal_clk */ + clk_enable(plat_data->spdif_core_clk); + spdif_softreset(); + /* disable all the interrupts */ + spdif_intr_enable(0xffffff, 0); + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ret = mxc_spdif_playback_startup(substream, dai); else @@ -1068,12 +1077,18 @@ static int mxc_spdif_startup(struct snd_pcm_substream *substream, static void mxc_spdif_shutdown(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { + struct snd_soc_codec *codec = dai->codec; + struct mxc_spdif_priv *spdif_priv = snd_soc_codec_get_drvdata(codec); + struct mxc_spdif_platform_data *plat_data = spdif_priv->plat_data; int ret; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ret = mxc_spdif_playback_shutdown(substream, dai); else ret = mxc_spdif_capture_shutdown(substream, dai); + /* disable spdif_core clock */ + clk_put(plat_data->spdif_clk); + clk_disable(plat_data->spdif_core_clk); } static int mxc_spdif_prepare(struct snd_pcm_substream *substream, @@ -1252,13 +1267,6 @@ static int __devinit mxc_spdif_probe(struct platform_device *pdev) atomic_set(&spdif_priv->dpll_locked, 0); - /* spdif_xtal_clk */ - clk_enable(plat_data->spdif_core_clk); - spdif_softreset(); - - /* disable all the interrupts */ - spdif_intr_enable(0xffffff, 0); - /* spdif interrupt register and disable */ irq = platform_get_irq(pdev, 0); if ((irq <= 0) || request_irq(irq, spdif_isr, 0, "spdif", spdif_priv)) { @@ -1292,13 +1300,9 @@ failed_clk: static int __devexit mxc_spdif_remove(struct platform_device *pdev) { struct mxc_spdif_priv *spdif_priv = platform_get_drvdata(pdev); - struct mxc_spdif_platform_data *plat_data = spdif_priv->plat_data; snd_soc_unregister_codec(&pdev->dev); - clk_put(plat_data->spdif_clk); - clk_disable(plat_data->spdif_core_clk); - platform_set_drvdata(pdev, NULL); kfree(spdif_priv); |