summaryrefslogtreecommitdiff
path: root/sound/soc/fsl/fsl_xcvr.c
diff options
context:
space:
mode:
authorViorel Suman <viorel.suman@nxp.com>2020-03-24 18:08:43 +0200
committerViorel Suman <viorel.suman@nxp.com>2020-03-25 10:49:09 +0200
commita063fac437ceb71a98edb23725124246927e41dc (patch)
tree4f998b047bf9221d6fc5aaecd4f6546644c10c47 /sound/soc/fsl/fsl_xcvr.c
parent9c6b7f731a9647503ae4e2f3f7f1d13d510a1455 (diff)
MLK-23603-6: ASoC: fsl_xcvr: move clks management into suspend/resume
Move clocks prepare_enable and disable_unprepare calls into runtime_resume and runtime_suspend respectively. Signed-off-by: Viorel Suman <viorel.suman@nxp.com> Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Diffstat (limited to 'sound/soc/fsl/fsl_xcvr.c')
-rw-r--r--sound/soc/fsl/fsl_xcvr.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/sound/soc/fsl/fsl_xcvr.c b/sound/soc/fsl/fsl_xcvr.c
index 558e8de1be66..9abd74250f20 100644
--- a/sound/soc/fsl/fsl_xcvr.c
+++ b/sound/soc/fsl/fsl_xcvr.c
@@ -907,7 +907,7 @@ static int fsl_xcvr_probe(struct platform_device *pdev)
if (IS_ERR(regs))
return PTR_ERR(regs);
- xcvr->regmap = devm_regmap_init_mmio_clk(dev, "ipg", regs,
+ xcvr->regmap = devm_regmap_init_mmio_clk(dev, NULL, regs,
&fsl_xcvr_regmap_cfg);
if (IS_ERR(xcvr->regmap)) {
dev_err(dev, "failed to init XCVR regmap: %ld\n",
@@ -1003,24 +1003,6 @@ static int fsl_xcvr_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, xcvr);
pm_runtime_enable(dev);
- ret = clk_prepare_enable(xcvr->ipg_clk);
- if (ret) {
- dev_err(dev, "failed to start IPG clock.\n");
- return ret;
- }
-
- ret = clk_prepare_enable(xcvr->phy_clk);
- if (ret) {
- dev_err(dev, "failed to start PHY clock.\n");
- return ret;
- }
-
- ret = clk_prepare_enable(xcvr->spba_clk);
- if (ret) {
- dev_err(dev, "failed to start SPBA clock.\n");
- return ret;
- }
-
if (xcvr->mode & FSL_XCVR_DMODE_TX)
fsl_xcvr_dai.playback = playback;
@@ -1057,6 +1039,10 @@ static int fsl_xcvr_runtime_suspend(struct device *dev)
regcache_cache_only(xcvr->regmap, true);
+ clk_disable_unprepare(xcvr->spba_clk);
+ clk_disable_unprepare(xcvr->phy_clk);
+ clk_disable_unprepare(xcvr->ipg_clk);
+
return 0;
}
@@ -1065,6 +1051,27 @@ static int fsl_xcvr_runtime_resume(struct device *dev)
struct fsl_xcvr *xcvr = dev_get_drvdata(dev);
int ret;
+ ret = clk_prepare_enable(xcvr->ipg_clk);
+ if (ret) {
+ dev_err(dev, "failed to start IPG clock.\n");
+ return ret;
+ }
+
+ ret = clk_prepare_enable(xcvr->phy_clk);
+ if (ret) {
+ dev_err(dev, "failed to start PHY clock.\n");
+ clk_disable_unprepare(xcvr->ipg_clk);
+ return ret;
+ }
+
+ ret = clk_prepare_enable(xcvr->spba_clk);
+ if (ret) {
+ dev_err(dev, "failed to start SPBA clock.\n");
+ clk_disable_unprepare(xcvr->phy_clk);
+ clk_disable_unprepare(xcvr->ipg_clk);
+ return ret;
+ }
+
regcache_cache_only(xcvr->regmap, false);
regcache_mark_dirty(xcvr->regmap);
ret = regcache_sync(xcvr->regmap);