From 07bd875c18abe48c268d653cd51229041e12d399 Mon Sep 17 00:00:00 2001 From: Mukul Sharma Date: Tue, 10 Oct 2017 16:58:14 +0530 Subject: [PATCH] qcacld-3.0: Acquire wakelock until change iface timer expires Currently, when wifi is disabled from UI, and if the device goes to suspend before the interface change timer expires, then until the next APPS wakeup wifi remains enabled hence power numbers are high. As a part of fix, Host acquire wakelock when it start change interface timer. Change-Id: I41662596725315a6cfe185ee23ae889b69938e0b CRs-Fixed: 2091154 --- core/hdd/inc/wlan_hdd_cfg.h | 2 +- core/hdd/src/wlan_hdd_main.c | 12 +++++++++++- core/hdd/src/wlan_hdd_p2p.c | 3 +++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index fd04a684b41d..96dbcb34eb7f 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -2110,7 +2110,7 @@ enum hdd_dot11_mode { #define CFG_INTERFACE_CHANGE_WAIT_NAME "gInterfaceChangeWait" #define CFG_INTERFACE_CHANGE_WAIT_MIN (10) #define CFG_INTERFACE_CHANGE_WAIT_MAX (500000) -#define CFG_INTERFACE_CHANGE_WAIT_DEFAULT (5000) +#define CFG_INTERFACE_CHANGE_WAIT_DEFAULT (10000) /* * diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index df6c3ffd4986..daff287dda01 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -2651,6 +2651,9 @@ static int __hdd_stop(struct net_device *dev) hdd_debug("Closing all modules from the hdd_stop"); qdf_mc_timer_start(&hdd_ctx->iface_change_timer, hdd_ctx->config->iface_change_wait_time); + hdd_prevent_suspend_timeout( + hdd_ctx->config->iface_change_wait_time, + WIFI_POWER_EVENT_WAKELOCK_IFACE_CHANGE_TIMER); } EXIT(); @@ -9543,6 +9546,9 @@ int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode) mutex_unlock(&hdd_ctx->iface_change_lock); qdf_mc_timer_start(&hdd_ctx->iface_change_timer, hdd_ctx->config->iface_change_wait_time); + hdd_prevent_suspend_timeout( + hdd_ctx->config->iface_change_wait_time, + WIFI_POWER_EVENT_WAKELOCK_IFACE_CHANGE_TIMER); hdd_ctx->stop_modules_in_progress = false; return 0; } @@ -9913,9 +9919,13 @@ int hdd_wlan_startup(struct device *dev) if (hdd_ctx->config->fIsImpsEnabled) hdd_set_idle_ps_config(hdd_ctx, true); - if (QDF_GLOBAL_FTM_MODE != hdd_get_conparam()) + if (QDF_GLOBAL_FTM_MODE != hdd_get_conparam()) { qdf_mc_timer_start(&hdd_ctx->iface_change_timer, hdd_ctx->config->iface_change_wait_time); + hdd_prevent_suspend_timeout( + hdd_ctx->config->iface_change_wait_time, + WIFI_POWER_EVENT_WAKELOCK_IFACE_CHANGE_TIMER); + } hdd_start_complete(0); goto success; diff --git a/core/hdd/src/wlan_hdd_p2p.c b/core/hdd/src/wlan_hdd_p2p.c index 7c02960e1361..37beed15a21f 100644 --- a/core/hdd/src/wlan_hdd_p2p.c +++ b/core/hdd/src/wlan_hdd_p2p.c @@ -2380,6 +2380,9 @@ stop_modules: hdd_debug("Closing all modules from the add_virt_iface"); qdf_mc_timer_start(&hdd_ctx->iface_change_timer, hdd_ctx->config->iface_change_wait_time); + hdd_prevent_suspend_timeout( + hdd_ctx->config->iface_change_wait_time, + WIFI_POWER_EVENT_WAKELOCK_IFACE_CHANGE_TIMER); } else hdd_debug("Other interfaces are still up dont close modules!");