Skip to content

Commit 9d2fd8d

Browse files
author
Sugar Zhang
committed
ASoC: rockchip: i2s: 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: I9c495361fcb7fb0a06fe1538d05b94617e332756
1 parent fedc8a6 commit 9d2fd8d

1 file changed

Lines changed: 18 additions & 8 deletions

File tree

sound/soc/rockchip/rockchip_i2s.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -856,18 +856,11 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
856856

857857
dev_set_drvdata(&pdev->dev, i2s);
858858

859-
pm_runtime_enable(&pdev->dev);
860-
if (!pm_runtime_enabled(&pdev->dev)) {
861-
ret = i2s_runtime_resume(&pdev->dev);
862-
if (ret)
863-
goto err_pm_disable;
864-
}
865-
866859
soc_dai = devm_kmemdup(&pdev->dev, &rockchip_i2s_dai,
867860
sizeof(*soc_dai), GFP_KERNEL);
868861
if (!soc_dai) {
869862
ret = -ENOMEM;
870-
goto err_pm_disable;
863+
goto err_clk;
871864
}
872865

873866
if (!of_property_read_u32(node, "rockchip,playback-channels", &val)) {
@@ -903,6 +896,23 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
903896
regmap_update_bits(i2s->regmap, I2S_CKR,
904897
I2S_CKR_TRCM_MASK, i2s->clk_trcm);
905898

899+
/*
900+
* MUST: after pm_runtime_enable step, any register R/W
901+
* should be wrapped with pm_runtime_get_sync/put.
902+
*
903+
* Another approach is to enable the regcache true to
904+
* avoid access HW registers.
905+
*
906+
* Alternatively, performing the registers R/W before
907+
* pm_runtime_enable is also a good option.
908+
*/
909+
pm_runtime_enable(&pdev->dev);
910+
if (!pm_runtime_enabled(&pdev->dev)) {
911+
ret = i2s_runtime_resume(&pdev->dev);
912+
if (ret)
913+
goto err_pm_disable;
914+
}
915+
906916
ret = devm_snd_soc_register_component(&pdev->dev,
907917
&rockchip_i2s_component,
908918
soc_dai, 1);

0 commit comments

Comments
 (0)