Skip to content

Commit

Permalink
ASoC: fsl_sai: Refine regcache usage with pm runtime
Browse files Browse the repository at this point in the history
When there is dedicated power domain bound with device, after probing
the power will be disabled, then registers are not accessible in
fsl_sai_dai_probe(), so regcache only need to be enabled in end of
probe() and regcache_mark_dirty should be moved to pm runtime resume
callback function.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/1593412953-10897-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Shengjiu Wang authored and Mark Brown committed Jul 1, 2020
1 parent 351cf74 commit d8d702e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sound/soc/fsl/fsl_sai.c
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,7 @@ static int fsl_sai_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, sai);

pm_runtime_enable(&pdev->dev);
regcache_cache_only(sai->regmap, true);

ret = devm_snd_soc_register_component(&pdev->dev, &fsl_component,
&fsl_sai_dai, 1);
Expand Down Expand Up @@ -1107,7 +1108,6 @@ static int fsl_sai_runtime_suspend(struct device *dev)
clk_disable_unprepare(sai->bus_clk);

regcache_cache_only(sai->regmap, true);
regcache_mark_dirty(sai->regmap);

return 0;
}
Expand Down Expand Up @@ -1137,6 +1137,7 @@ static int fsl_sai_runtime_resume(struct device *dev)
}

regcache_cache_only(sai->regmap, false);
regcache_mark_dirty(sai->regmap);
regmap_write(sai->regmap, FSL_SAI_TCSR(ofs), FSL_SAI_CSR_SR);
regmap_write(sai->regmap, FSL_SAI_RCSR(ofs), FSL_SAI_CSR_SR);
usleep_range(1000, 2000);
Expand Down

0 comments on commit d8d702e

Please sign in to comment.