ASoC: rockchip: sai: Fix register access in probe

MUST: after pm_runtime_enable step, any register R/W
should be wrapped with pm_runtime_get_sync/put.

Another approach is to enable the regcache true to
avoid access HW registers.

Alternatively, performing the registers R/W before
pm_runtime_enable is also a good option.

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: Ife9b1a0e6f75e714bfb6e7c0d472e4603fa8cd8f
This commit is contained in:
Sugar Zhang
2023-08-11 16:10:31 +08:00
committed by Tao Huang
parent f9a676b76c
commit f8a6ea7388

View File

@@ -1398,6 +1398,20 @@ static int rockchip_sai_probe(struct platform_device *pdev)
if (ret)
return ret;
ret = rockchip_sai_init_dai(sai, res, &dai);
if (ret)
return ret;
/*
* MUST: after pm_runtime_enable step, any register R/W
* should be wrapped with pm_runtime_get_sync/put.
*
* Another approach is to enable the regcache true to
* avoid access HW registers.
*
* Alternatively, performing the registers R/W before
* pm_runtime_enable is also a good option.
*/
pm_runtime_enable(&pdev->dev);
if (!pm_runtime_enabled(&pdev->dev)) {
ret = rockchip_sai_runtime_resume(&pdev->dev);
@@ -1405,10 +1419,6 @@ static int rockchip_sai_probe(struct platform_device *pdev)
goto err_runtime_disable;
}
ret = rockchip_sai_init_dai(sai, res, &dai);
if (ret)
goto err_runtime_suspend;
ret = devm_snd_soc_register_component(&pdev->dev,
&rockchip_sai_component,
dai, 1);