From 3818e25a7fec68413b6c4382c1f12ec5fe956350 Mon Sep 17 00:00:00 2001 From: Bing Song Date: Tue, 9 Jun 2020 15:26:37 +0800 Subject: MLK-24365-2 dsp: manage audiomix clock in dsp driver. IMX8MP_CLK_AUDIO_ROOT and IMX8MP_CLK_AUDIO_AXI_DIV will gated when suspend even if dsp driver ignored suspend when low power audio offload playback. The root cause is the two clocks is controlled when audiomix power on/off. Add the two clocks in dsp driver, so driver will add one ref count when useing dsp, so the two clocks don't be gated when A core suspend during low power audio playback. Signed-off-by: Bing Song --- sound/soc/fsl/fsl_dsp.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'sound/soc/fsl/fsl_dsp.c') diff --git a/sound/soc/fsl/fsl_dsp.c b/sound/soc/fsl/fsl_dsp.c index a6d3a7206888..3679191f0e66 100644 --- a/sound/soc/fsl/fsl_dsp.c +++ b/sound/soc/fsl/fsl_dsp.c @@ -1159,6 +1159,14 @@ static int fsl_dsp_probe(struct platform_device *pdev) if (IS_ERR(dsp_priv->dsp_ocrama_clk)) dsp_priv->dsp_ocrama_clk = NULL; + dsp_priv->audio_root_clk = devm_clk_get(&pdev->dev, "audio_root"); + if (IS_ERR(dsp_priv->audio_root_clk)) + dsp_priv->audio_root_clk = NULL; + + dsp_priv->audio_axi_clk = devm_clk_get(&pdev->dev, "audio_axi"); + if (IS_ERR(dsp_priv->audio_axi_clk)) + dsp_priv->audio_axi_clk = NULL; + dsp_priv->dsp_root_clk = devm_clk_get(&pdev->dev, "core"); if (IS_ERR(dsp_priv->dsp_root_clk)) dsp_priv->dsp_root_clk = NULL; @@ -1282,6 +1290,18 @@ static int fsl_dsp_runtime_resume(struct device *dev) goto dsp_root_clk; } + ret = clk_prepare_enable(dsp_priv->audio_root_clk); + if (ret < 0) { + dev_err(dev, "Failed to enable audio_root_clk ret = %d\n", ret); + goto audio_root_clk; + } + + ret = clk_prepare_enable(dsp_priv->audio_axi_clk); + if (ret < 0) { + dev_err(dev, "Failed to enable audio_axi_clk ret = %d\n", ret); + goto audio_axi_clk; + } + ret = clk_prepare_enable(dsp_priv->debug_clk); if (ret < 0) { dev_err(dev, "Failed to enable debug_clk ret = %d\n", ret); @@ -1373,6 +1393,10 @@ static int fsl_dsp_runtime_resume(struct device *dev) mu2_clk: clk_disable_unprepare(dsp_priv->debug_clk); debug_clk: + clk_disable_unprepare(dsp_priv->audio_axi_clk); +audio_axi_clk: + clk_disable_unprepare(dsp_priv->audio_root_clk); +audio_root_clk: clk_disable_unprepare(dsp_priv->dsp_root_clk); dsp_root_clk: clk_disable_unprepare(dsp_priv->dsp_ocrama_clk); @@ -1411,6 +1435,8 @@ static int fsl_dsp_runtime_suspend(struct device *dev) clk_disable_unprepare(dsp_priv->dsp_ocrama_clk); clk_disable_unprepare(dsp_priv->dsp_root_clk); + clk_disable_unprepare(dsp_priv->audio_root_clk); + clk_disable_unprepare(dsp_priv->audio_axi_clk); clk_disable_unprepare(dsp_priv->debug_clk); clk_disable_unprepare(dsp_priv->mu2_clk); clk_disable_unprepare(dsp_priv->sdma_root_clk); -- cgit v1.2.3