summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>2023-05-03 13:34:11 +0200
committerMark Brown <broonie@kernel.org>2023-05-08 08:48:24 +0900
commit2ca0ec01d49c9c2742c2151ae94c94bdf36bb1b8 (patch)
treef0c109a1816dcb435fe4c5d51999c9b5aa3d4c65 /sound
parent686d041685639493a608bdcdb0d00551796721c9 (diff)
downloadlinux-next-2ca0ec01d49c9c2742c2151ae94c94bdf36bb1b8.tar.gz
ASoC: mediatek: mt8195-afe-pcm: Simplify runtime PM during probe
Use devm_pm_runtime_enable() and pm_runtime_resume_and_get() to to simplify the probe function. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com Link: https://lore.kernel.org/r/20230503113413.149235-4-angelogioacchino.delregno@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/mediatek/mt8195/mt8195-afe-pcm.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c b/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
index 4d586c40399b..912085c4cb36 100644
--- a/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
+++ b/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
@@ -3160,16 +3160,16 @@ static int mt8195_afe_pcm_dev_probe(struct platform_device *pdev)
dev_dbg(afe->dev, "Cannot find topckgen controller: %ld\n",
PTR_ERR(afe_priv->topckgen));
- pm_runtime_enable(dev);
- if (!pm_runtime_enabled(dev)) {
- ret = mt8195_afe_runtime_resume(dev);
- if (ret)
- return ret;
- }
-
/* enable clock for regcache get default value from hw */
afe_priv->pm_runtime_bypass_reg_ctl = true;
- pm_runtime_get_sync(dev);
+
+ ret = devm_pm_runtime_enable(dev);
+ if (ret)
+ return ret;
+
+ ret = pm_runtime_resume_and_get(dev);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to resume device\n");
afe->regmap = devm_regmap_init_mmio(&pdev->dev, afe->base_addr,
&mt8195_afe_regmap_config);
@@ -3222,7 +3222,10 @@ static int mt8195_afe_pcm_dev_probe(struct platform_device *pdev)
if (ret)
goto err_pm_put;
- pm_runtime_put_sync(dev);
+ ret = pm_runtime_put_sync(dev);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to suspend device\n");
+
afe_priv->pm_runtime_bypass_reg_ctl = false;
regcache_cache_only(afe->regmap, true);
@@ -3232,7 +3235,6 @@ static int mt8195_afe_pcm_dev_probe(struct platform_device *pdev)
err_pm_put:
pm_runtime_put_sync(dev);
- pm_runtime_disable(dev);
return ret;
}