Skip to content

Commit 50a69c5

Browse files
author
Sugar Zhang
committed
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
1 parent 67d3781 commit 50a69c5

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

sound/soc/rockchip/rockchip_i2s_tdm.c

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2731,13 +2731,6 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev)
27312731
atomic_set(&i2s_tdm->refcount, 0);
27322732
dev_set_drvdata(&pdev->dev, i2s_tdm);
27332733

2734-
pm_runtime_enable(&pdev->dev);
2735-
if (!pm_runtime_enabled(&pdev->dev)) {
2736-
ret = i2s_tdm_runtime_resume(&pdev->dev);
2737-
if (ret)
2738-
goto err_pm_disable;
2739-
}
2740-
27412734
regmap_update_bits(i2s_tdm->regmap, I2S_DMACR, I2S_DMACR_TDL_MASK,
27422735
I2S_DMACR_TDL(16));
27432736
regmap_update_bits(i2s_tdm->regmap, I2S_DMACR, I2S_DMACR_RDL_MASK,
@@ -2755,6 +2748,23 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev)
27552748
*/
27562749
if (i2s_tdm->quirks & QUIRK_ALWAYS_ON) {
27572750
ret = rockchip_i2s_tdm_keep_clk_always_on(i2s_tdm);
2751+
if (ret)
2752+
return ret;
2753+
}
2754+
2755+
/*
2756+
* MUST: after pm_runtime_enable step, any register R/W
2757+
* should be wrapped with pm_runtime_get_sync/put.
2758+
*
2759+
* Another approach is to enable the regcache true to
2760+
* avoid access HW registers.
2761+
*
2762+
* Alternatively, performing the registers R/W before
2763+
* pm_runtime_enable is also a good option.
2764+
*/
2765+
pm_runtime_enable(&pdev->dev);
2766+
if (!pm_runtime_enabled(&pdev->dev)) {
2767+
ret = i2s_tdm_runtime_resume(&pdev->dev);
27582768
if (ret)
27592769
goto err_pm_disable;
27602770
}

0 commit comments

Comments
 (0)