diff options
author | Adrian Alonso <aalonso@freescale.com> | 2012-04-25 18:05:44 -0500 |
---|---|---|
committer | Adrian Alonso <aalonso@freescale.com> | 2012-04-26 19:03:44 -0500 |
commit | d8aa89ab7b867fc464af2e8ddb6aa48c0ed9ab68 (patch) | |
tree | 895d0f62ce05f38900a261ed1ca991a75055722d /sound | |
parent | 6ca6cc79c0bd9225e3d22f4112f63a11d392cf5f (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); |