ASoC: fsl_micfil: Don't use devm_regmap_init_mmio_clk

When there is power domain bind with ipg_clk clock,

The call flow:
devm_regmap_init_mmio_clk
   - clk_prepare()
      - clk_pm_runtime_get()

cause the power domain of clock always be enabled after
regmap_init(). which impact the power consumption.

So use devm_regmap_init_mmio instead of
devm_regmap_init_mmio_clk,but explicitly enable
clock when it is used.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
Link: https://lore.kernel.org/r/1616579928-22428-7-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Shengjiu Wang 2021-03-24 17:58:48 +08:00 committed by Mark Brown
parent 3feaba79d8
commit b5cf28f7a8
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -31,6 +31,7 @@ struct fsl_micfil {
struct platform_device *pdev;
struct regmap *regmap;
const struct fsl_micfil_soc_data *soc;
struct clk *busclk;
struct clk *mclk;
struct snd_dmaengine_dai_dma_data dma_params_rx;
unsigned int dataline;
@ -660,16 +661,22 @@ static int fsl_micfil_probe(struct platform_device *pdev)
return PTR_ERR(micfil->mclk);
}
micfil->busclk = devm_clk_get(&pdev->dev, "ipg_clk");
if (IS_ERR(micfil->busclk)) {
dev_err(&pdev->dev, "failed to get ipg clock: %ld\n",
PTR_ERR(micfil->busclk));
return PTR_ERR(micfil->busclk);
}
/* init regmap */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(regs))
return PTR_ERR(regs);
micfil->regmap = devm_regmap_init_mmio_clk(&pdev->dev,
"ipg_clk",
regs,
&fsl_micfil_regmap_config);
micfil->regmap = devm_regmap_init_mmio(&pdev->dev,
regs,
&fsl_micfil_regmap_config);
if (IS_ERR(micfil->regmap)) {
dev_err(&pdev->dev, "failed to init MICFIL regmap: %ld\n",
PTR_ERR(micfil->regmap));
@ -729,6 +736,7 @@ static int fsl_micfil_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, micfil);
pm_runtime_enable(&pdev->dev);
regcache_cache_only(micfil->regmap, true);
ret = devm_snd_soc_register_component(&pdev->dev, &fsl_micfil_component,
&fsl_micfil_dai, 1);
@ -752,6 +760,7 @@ static int __maybe_unused fsl_micfil_runtime_suspend(struct device *dev)
regcache_cache_only(micfil->regmap, true);
clk_disable_unprepare(micfil->mclk);
clk_disable_unprepare(micfil->busclk);
return 0;
}
@ -761,10 +770,16 @@ static int __maybe_unused fsl_micfil_runtime_resume(struct device *dev)
struct fsl_micfil *micfil = dev_get_drvdata(dev);
int ret;
ret = clk_prepare_enable(micfil->mclk);
ret = clk_prepare_enable(micfil->busclk);
if (ret < 0)
return ret;
ret = clk_prepare_enable(micfil->mclk);
if (ret < 0) {
clk_disable_unprepare(micfil->busclk);
return ret;
}
regcache_cache_only(micfil->regmap, false);
regcache_mark_dirty(micfil->regmap);
regcache_sync(micfil->regmap);