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
committed by Tao Huang
parent d7b9c64e08
commit 6752fef5c3

View File

@@ -2864,8 +2864,6 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev)
i2s_tdm->mclk_root1_freq = i2s_tdm->mclk_root1_initial_freq;
}
pm_runtime_enable(&pdev->dev);
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,
@@ -2883,7 +2881,7 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev)
if (i2s_tdm->is_tdm_multi_lanes) {
ret = rockchip_i2s_tdm_multi_lanes_parse(i2s_tdm);
if (ret)
goto err_suspend;
goto err_disable_hclk;
}
#endif
/*
@@ -2894,9 +2892,21 @@ 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)
goto err_suspend;
goto err_disable_hclk;
}
/*
* 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);
ret = devm_snd_soc_register_component(&pdev->dev,
&rockchip_i2s_tdm_component,
i2s_tdm->dai, 1);