diff options
author | Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> | 2023-04-20 10:17:58 +0000 |
---|---|---|
committer | Android Partner Code Review <android-gerrit-partner@google.com> | 2023-04-20 10:17:58 +0000 |
commit | 17a7d0cd770875719f046a75f76114565e1e9fb1 (patch) | |
tree | bfbe09197eb92d1325e512b573017314c01abb47 | |
parent | fc261afaf30c774f6ad55be1ef240998f6b0720b (diff) | |
parent | ec60c986df8db981effe488e7a0df22ffa07c4e5 (diff) | |
download | wlan-17a7d0cd770875719f046a75f76114565e1e9fb1.tar.gz |
Merge "qcacmn: Add a wakelock to prevent system suspend in SAP/GO/NDP mode" into android13-gs-pixel-5.10-udc
-rw-r--r-- | qca-wifi-host-cmn/hif/src/hif_main.c | 34 | ||||
-rw-r--r-- | qca-wifi-host-cmn/utils/host_diag_log/inc/host_diag_core_event.h | 2 |
2 files changed, 34 insertions, 2 deletions
diff --git a/qca-wifi-host-cmn/hif/src/hif_main.c b/qca-wifi-host-cmn/hif/src/hif_main.c index e3ea755..4761edd 100644 --- a/qca-wifi-host-cmn/hif/src/hif_main.c +++ b/qca-wifi-host-cmn/hif/src/hif_main.c @@ -52,6 +52,9 @@ #include <qdf_hang_event_notifier.h> #endif #include <linux/cpumask.h> +#include "host_diag_core_event.h" + +static qdf_wake_lock_t wlan_hif_sap_wake_lock; #if defined(HIF_IPCI) && defined(FEATURE_HAL_DELAYED_REG_WRITE) #include <pld_common.h> @@ -134,9 +137,25 @@ void hif_vote_link_down(struct hif_opaque_softc *hif_ctx) scn->linkstate_vote--; hif_info("Down_linkstate_vote %d", scn->linkstate_vote); - if (scn->linkstate_vote == 0) + if (scn->linkstate_vote == 0) { hif_bus_prevent_linkdown(scn, false); + qdf_wake_lock_release(&wlan_hif_sap_wake_lock, + WIFI_POWER_EVENT_WAKELOCK_HIF_SAP); + hif_info("Allow system suspend"); + } +} + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) +static void hif_abort_system_suspend(void) +{ + hif_info("Abort system suspend"); + qdf_pm_system_wakeup(); } +#else +static void hif_abort_system_suspend(void) +{ +} +#endif /** * hif_vote_link_up(): vote to prevent bus from suspending @@ -156,8 +175,13 @@ void hif_vote_link_up(struct hif_opaque_softc *hif_ctx) QDF_BUG(scn); scn->linkstate_vote++; hif_info("Up_linkstate_vote %d", scn->linkstate_vote); - if (scn->linkstate_vote == 1) + if (scn->linkstate_vote == 1) { hif_bus_prevent_linkdown(scn, true); + hif_info("Prevent system suspend"); + qdf_wake_lock_acquire(&wlan_hif_sap_wake_lock, + WIFI_POWER_EVENT_WAKELOCK_HIF_SAP); + hif_abort_system_suspend(); + } } /** @@ -954,6 +978,10 @@ struct hif_opaque_softc *hif_open(qdf_device_t qdf_ctx, hif_cpuhp_register(scn); hif_latency_detect_timer_init(scn); + status = qdf_wake_lock_create(&wlan_hif_sap_wake_lock, "wlan_hif_sap"); + if (status != 0) + hif_err("Cannot create hif wakelock"); + out: return GET_HIF_OPAQUE_HDL(scn); } @@ -986,6 +1014,8 @@ void hif_close(struct hif_opaque_softc *hif_ctx) { struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); + qdf_wake_lock_destroy(&wlan_hif_sap_wake_lock); + if (!scn) { hif_err("hif_opaque_softc is NULL"); return; diff --git a/qca-wifi-host-cmn/utils/host_diag_log/inc/host_diag_core_event.h b/qca-wifi-host-cmn/utils/host_diag_log/inc/host_diag_core_event.h index f3eca27..a360aea 100644 --- a/qca-wifi-host-cmn/utils/host_diag_log/inc/host_diag_core_event.h +++ b/qca-wifi-host-cmn/utils/host_diag_log/inc/host_diag_core_event.h @@ -950,6 +950,7 @@ enum wifi_connectivity_events { * @WIFI_POWER_EVENT_WAKELOCK_SAP_D3_WOW: Wakelock for SAP D3 WOW max clinets * @WIFI_POWER_EVENT_WAKELOCK_GO_D3_WOW: Wakelock for GO D3 WOW max clients * @WIFI_POWER_EVENT_WAKELOCK_RTPM_TPUT_POLICY: Wakelock for RTPM Tput policy + * @WIFI_POWER_EVENT_WAKELOCK_HIF_SAP: Wakelock for SAP link up vote * * Indicates the reason for which the wakelock was taken/released */ @@ -984,6 +985,7 @@ enum wake_lock_reason { WIFI_POWER_EVENT_WAKELOCK_SAP_D3_WOW, WIFI_POWER_EVENT_WAKELOCK_GO_D3_WOW, WIFI_POWER_EVENT_WAKELOCK_RTPM_TPUT_POLICY, + WIFI_POWER_EVENT_WAKELOCK_HIF_SAP, }; /* The length of interface name should >= IFNAMSIZ */ |