From 9a4b400adb75c34c8c81331c3baee40e1a80ec01 Mon Sep 17 00:00:00 2001 From: Sivakanth Vaka Date: Mon, 17 May 2021 11:05:43 +0530 Subject: [PATCH] ipa3: Changes to keep IPA clock voted in shutdown notifier Adding changes to avoid unclocked access in shutdown notifier. Increasing the IPA clock vote before saving the IPA registers. Signed-off-by: Sivakanth vaka --- drivers/platform/msm/ipa/ipa_v3/ipa.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa.c b/drivers/platform/msm/ipa/ipa_v3/ipa.c index eee1a7ecaaa2..50f571cd8320 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa.c @@ -9098,9 +9098,22 @@ static void ipa_smmu_update_fw_loader(void) void ipa3_plat_drv_shutdown(struct platform_device *pdev_p) { + int res; + struct ipa_active_client_logging_info log_info; + pr_debug("ipa: driver shutdown invoked for %s\n", pdev_p->dev.of_node->name); - if (ipa3_ctx && atomic_read(&ipa3_ctx->ipa_clk_vote)) { + if(unlikely(!ipa3_ctx)) + { + IPAERR("IPA driver not initialized\n"); + return; + } + /* Make sure IPA clock voted when collecting the reg dump */ + IPA_ACTIVE_CLIENTS_PREP_SPECIAL(log_info, "SHUTDOWN_VOTE"); + res = ipa3_inc_client_enable_clks_no_block(&log_info); + if (res) { + IPAERR("IPA clk off not saving the IPA registers\n"); + } else { ipahal_print_all_regs(false); ipa_save_registers(); }