mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
ASoC: mediatek: mt8192 probe cleanup
Cássio Gabriel <cassiogabrielcontato@gmail.com> says: Fix two MT8192 AFE probe cleanup issues that mirror the recently fixed MT8189 and MT8196 paths. The first patch registers a devm cleanup action for a successful reserved-memory assignment so later probe failures and driver unbind release it. The second patch checks the temporary runtime resume used while reinitializing the regmap cache and makes the regcache failure path drop the PM reference and clear pm_runtime_bypass_reg_ctl. Link: https://patch.msgid.link/20260527-asoc-mt8192-probe-cleanup-v1-0-1bb834d05b72@gmail.com
This commit is contained in:
commit
44a4b0e62b
|
|
@ -2155,6 +2155,11 @@ static const dai_register_cb dai_register_cbs[] = {
|
|||
mt8192_dai_memif_register,
|
||||
};
|
||||
|
||||
static void mt8192_afe_release_reserved_mem(void *data)
|
||||
{
|
||||
of_reserved_mem_device_release(data);
|
||||
}
|
||||
|
||||
static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct mtk_base_afe *afe;
|
||||
|
|
@ -2184,6 +2189,10 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev)
|
|||
if (ret) {
|
||||
dev_info(dev, "no reserved memory found, pre-allocating buffers instead\n");
|
||||
afe->preallocate_buffers = true;
|
||||
} else {
|
||||
ret = devm_add_action_or_reset(dev, mt8192_afe_release_reserved_mem, dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* init audio related clock */
|
||||
|
|
@ -2218,15 +2227,19 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev)
|
|||
|
||||
/* enable clock for regcache get default value from hw */
|
||||
afe_priv->pm_runtime_bypass_reg_ctl = true;
|
||||
pm_runtime_get_sync(dev);
|
||||
ret = pm_runtime_resume_and_get(dev);
|
||||
if (ret) {
|
||||
afe_priv->pm_runtime_bypass_reg_ctl = false;
|
||||
return dev_err_probe(dev, ret, "failed to resume device\n");
|
||||
}
|
||||
|
||||
ret = regmap_reinit_cache(afe->regmap, &mt8192_afe_regmap_config);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "regmap_reinit_cache fail\n");
|
||||
|
||||
pm_runtime_put_sync(dev);
|
||||
afe_priv->pm_runtime_bypass_reg_ctl = false;
|
||||
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "regmap_reinit_cache fail\n");
|
||||
|
||||
regcache_cache_only(afe->regmap, true);
|
||||
regcache_mark_dirty(afe->regmap);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user