ASoC: rockchip: i2s-tdm: 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: I69dd66230cba636d2ccb31ec01a21be1a482a0e3
This commit is contained in:
Sugar Zhang
2023-08-11 16:10:35 +08:00
parent f8a6ea7388
commit b59d476403

View File

@@ -2773,13 +2773,6 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev)
atomic_set(&i2s_tdm->refcount, 0);
dev_set_drvdata(&pdev->dev, i2s_tdm);
pm_runtime_enable(&pdev->dev);
if (!pm_runtime_enabled(&pdev->dev)) {
ret = i2s_tdm_runtime_resume(&pdev->dev);
if (ret)
goto err_pm_disable;
}
regmap_update_bits(i2s_tdm->regmap, I2S_DMACR, I2S_DMACR_TDL_MASK,
I2S_DMACR_TDL(16));
regmap_update_bits(i2s_tdm->regmap, I2S_DMACR, I2S_DMACR_RDL_MASK,
@@ -2797,6 +2790,23 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev)
*/
if (i2s_tdm->quirks & QUIRK_ALWAYS_ON) {
ret = rockchip_i2s_tdm_keep_clk_always_on(i2s_tdm);
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 = i2s_tdm_runtime_resume(&pdev->dev);
if (ret)
goto err_pm_disable;
}