From 54bd04b640d75ec73597d18329fb40b97119f5df Mon Sep 17 00:00:00 2001 From: Mohan Kumar Date: Wed, 17 Aug 2022 08:11:15 +0530 Subject: [PATCH] ASoC: tegra: Fix AHUB probe issue Make sure to call pm_runtime_enable() before the of_platform_populate() which will ensure ahub runtime resume would be called to enable ahub clock before accessing any ahub modules registers in modules probe. Calling of_platform_populate() in parent driver probe results in all of its child device probe to be completed before it exits the parent probe call. The issue caught during MVC child device probe tries to access a register in probe call which depends on the ahub clock that gets enabled during AHUB RPM resume. But ahub RPM resume not called as pm_runtime_enable() in ahub parent driver happens after the of_platform_populate(). This was observed when drivers were built as part of kernel image. Bug 3752938 Change-Id: Ifeb4085961d89877f79ff521adb6dfdf4e51907c Signed-off-by: Mohan Kumar Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2762027 Reviewed-by: Sameer Pujar Reviewed-by: svcacv Reviewed-by: Sharad Gupta GVS: Gerrit_Virtual_Submit --- sound/soc/tegra/tegra210_ahub.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sound/soc/tegra/tegra210_ahub.c b/sound/soc/tegra/tegra210_ahub.c index 8edb750f..72e56b08 100644 --- a/sound/soc/tegra/tegra210_ahub.c +++ b/sound/soc/tegra/tegra210_ahub.c @@ -2,7 +2,7 @@ // // tegra210_ahub.c - Tegra210 AHUB driver // -// Copyright (c) 2020-2021 NVIDIA CORPORATION. All rights reserved. +// Copyright (c) 2020-2022 NVIDIA CORPORATION. All rights reserved. #include #include @@ -1562,12 +1562,14 @@ static int tegra_ahub_probe(struct platform_device *pdev) return err; } - err = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); - if (err) - return err; - pm_runtime_enable(&pdev->dev); + err = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); + if (err) { + pm_runtime_disable(&pdev->dev); + return err; + } + return 0; }