From c8fb78d82d83462f2d0237e0893e56bfa95bdbbf Mon Sep 17 00:00:00 2001 From: Mohit Khanna Date: Mon, 11 May 2020 14:51:17 -0700 Subject: [PATCH] qcacld-3.0: Move BW voting to bus suspend/resume Current during system suspend/resume, we remove/add votes for DDR/SNOC during cfg80211 suspend/resume functions. However, check for pending TX completions and RX softirq processing happens in the bus suspend functions which get called after cfg80211 suspend/resume functions. Hence, there is a small time window where there may be DDR transactions from WLAN SOC with no vote for DDR/SNOC. This can lead to high bus latency as seen by WLAN SOC. To avoid this, move the bus voting for system suspend/resume operation in the bus suspend/resume functions. Change-Id: I9242d438c1fa07cd7a2dec6994f437d07dd9bb68 CRs-Fixed: 2673101 --- core/hdd/src/wlan_hdd_driver_ops.c | 12 ++++++++++++ core/hdd/src/wlan_hdd_power.c | 4 ---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c index fff7b7f169af..0a934066c1c2 100644 --- a/core/hdd/src/wlan_hdd_driver_ops.c +++ b/core/hdd/src/wlan_hdd_driver_ops.c @@ -1072,6 +1072,12 @@ static int __wlan_hdd_bus_suspend(struct wow_enable_params wow_params) goto resume_pmo; } + /* + * Remove bus votes at the very end, after making sure there are no + * pending bus transactions from WLAN SOC for TX/RX. + */ + pld_request_bus_bandwidth(hdd_ctx->parent_dev, PLD_BUS_WIDTH_NONE); + hdd_info("bus suspend succeeded"); return 0; @@ -1218,6 +1224,12 @@ int wlan_hdd_bus_resume(void) return -EINVAL; } + /* + * Add bus votes at the beginning, before making sure there are any + * bus transactions from WLAN SOC for TX/RX. + */ + pld_request_bus_bandwidth(hdd_ctx->parent_dev, PLD_BUS_WIDTH_MEDIUM); + status = hif_bus_resume(hif_ctx); if (status) { hdd_err("Failed hif bus resume"); diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index a80d500b9e2f..f36fd477e9cb 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -1717,8 +1717,6 @@ static int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) goto exit_with_code; } - pld_request_bus_bandwidth(hdd_ctx->parent_dev, PLD_BUS_WIDTH_MEDIUM); - status = hdd_resume_wlan(); if (status != QDF_STATUS_SUCCESS) { exit_code = 0; @@ -1973,8 +1971,6 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, hdd_ctx->is_wiphy_suspended = true; - pld_request_bus_bandwidth(hdd_ctx->parent_dev, PLD_BUS_WIDTH_NONE); - hdd_exit(); return 0;