From: Walker Chen Date: Wed, 26 Oct 2022 11:19:12 +0000 (+0800) Subject: CR_2345_Audio_DevicePM_walker.chen X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e9a3090389dcd50759f80d7ddca5721d7d404910;p=platform%2Fkernel%2Flinux-starfive.git CR_2345_Audio_DevicePM_walker.chen Disable clock when audio driver is loaded. Signed-off-by: Walker Chen --- diff --git a/sound/soc/starfive/starfive_pdm.c b/sound/soc/starfive/starfive_pdm.c index ba4bb61..ca52771 100644 --- a/sound/soc/starfive/starfive_pdm.c +++ b/sound/soc/starfive/starfive_pdm.c @@ -461,6 +461,12 @@ static int sf_pdm_probe(struct platform_device *pdev) } pm_runtime_enable(&pdev->dev); +#ifdef CONFIG_PM + clk_disable_unprepare(priv->clk_pdm_apb); + clk_disable_unprepare(priv->clk_pdm_mclk); + clk_disable_unprepare(priv->clk_mclk); +#endif + return 0; } @@ -485,9 +491,7 @@ static struct platform_driver sf_pdm_driver = { .driver = { .name = "jh7110-pdm", .of_match_table = sf_pdm_of_match, -#ifdef CONFIG_PM .pm = &sf_pdm_pm_ops, -#endif }, .probe = sf_pdm_probe, .remove = sf_pdm_dev_remove, diff --git a/sound/soc/starfive/starfive_tdm.c b/sound/soc/starfive/starfive_tdm.c index 28056b38..bd7372e 100644 --- a/sound/soc/starfive/starfive_tdm.c +++ b/sound/soc/starfive/starfive_tdm.c @@ -123,18 +123,22 @@ static void sf_tdm_config(struct sf_tdm_dev *dev, struct snd_pcm_substream *subs sf_tdm_writel(dev, TDM_PCMRXCR, datarx); } -#ifdef CONFIG_PM -static int sf_tdm_runtime_suspend(struct device *dev) +static void sf_tdm_clk_disable(struct sf_tdm_dev *priv) { - struct sf_tdm_dev *priv = dev_get_drvdata(dev); - clk_disable_unprepare(priv->clk_tdm); clk_disable_unprepare(priv->clk_tdm_ext); clk_disable_unprepare(priv->clk_tdm_internal); clk_disable_unprepare(priv->clk_tdm_apb); clk_disable_unprepare(priv->clk_tdm_ahb); clk_disable_unprepare(priv->clk_mclk_inner); +} +#ifdef CONFIG_PM +static int sf_tdm_runtime_suspend(struct device *dev) +{ + struct sf_tdm_dev *priv = dev_get_drvdata(dev); + + sf_tdm_clk_disable(priv); return 0; } @@ -690,6 +694,10 @@ static int sf_tdm_probe(struct platform_device *pdev) } pm_runtime_enable(&pdev->dev); +#ifdef CONFIG_PM + sf_tdm_clk_disable(dev); +#endif + return 0; } @@ -713,9 +721,7 @@ static struct platform_driver sf_tdm_driver = { .driver = { .name = "jh7110-tdm", .of_match_table = sf_tdm_of_match, -#ifdef CONFIG_PM .pm = &sf_tdm_pm_ops, -#endif }, .probe = sf_tdm_probe, .remove = sf_tdm_dev_remove,