diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c index 67bf01a5b00b..f9f4c0fc6176 100644 --- a/sound/soc/rockchip/rockchip_i2s_tdm.c +++ b/sound/soc/rockchip/rockchip_i2s_tdm.c @@ -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; }