[PATCH v2 2/2] ASoC: rockchip: rockchip_sai: Fix runtime PM state after manual resume

[email protected]
Newsgroups org.infradead.lists.linux-rockchip,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-sound
Message-ID <[email protected]>
From: bui duc phuc <[email protected]>

Probe manually resumes the device after pm_runtime_get_noresume().
Since the PM core is bypassed, runtime_status remains RPM_SUSPENDED even
though the hardware is active. A subsequent pm_runtime_put() therefore
skips runtime_suspend(), leaving the device permanently powered and
preventing autosuspend.

Fix this by calling pm_runtime_set_active() after the manual resume
succeeds, and defer pm_runtime_enable() until after the device has been
manually resumed and marked active. Also call pm_runtime_put_noidle()
on error to drop the usage count acquired by pm_runtime_get_noresume().

Signed-off-by: bui duc phuc <[email protected]>
---
 sound/soc/rockchip/rockchip_sai.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sound/soc/rockchip/rockchip_sai.c b/sound/soc/rockchip/rockchip_sai.c
index 9a80e120dbda..55d17536c3b5 100644
--- a/sound/soc/rockchip/rockchip_sai.c
+++ b/sound/soc/rockchip/rockchip_sai.c
@@ -1474,11 +1474,14 @@ static int rockchip_sai_probe(struct platform_device *pdev)
 	 *
 	 * NB: we don't rely on _resume_and_get in case of !CONFIG_PM
 	 */
-	devm_pm_runtime_enable(&pdev->dev);
 	pm_runtime_get_noresume(&pdev->dev);
 	ret = rockchip_sai_runtime_resume(&pdev->dev);
-	if (ret)
+	if (ret) {
+		pm_runtime_put_noidle(&pdev->dev);
 		return dev_err_probe(&pdev->dev, ret, "Failed to resume device\n");
+	}
+	pm_runtime_set_active(&pdev->dev);
+	devm_pm_runtime_enable(&pdev->dev);
 
 	ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
 	if (ret) {
-- 
2.43.0


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.