From 8edf3678c3bf4e15abe7e97ee69398917867822c Mon Sep 17 00:00:00 2001 From: Sachin Ahuja Date: Mon, 15 Feb 2021 17:23:30 +0530 Subject: [PATCH] qcacld-3.0: Start the psoc idle timer in cfg80211 resume During system suspend, the psoc idle timer is stopped. So it may happen that work was not scheduled and it got removed from the workqueue. This will result into the module state as enabled after system resume which will lead to extra power consumption. So, to avoid this issue, start the psoc idle timer in the system reume if all interfaces are down and module state is ENABLED. CRs-Fixed: 2867472 Change-Id: I2151e825919b45727a279a2285293e578ce86ffa --- core/hdd/src/wlan_hdd_power.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index a43b17c6fb25..dba3e491c41b 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -1968,6 +1968,19 @@ static int _wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) errno = __wlan_hdd_cfg80211_resume_wlan(wiphy); + /* It may happen during cfg80211 suspend this timer is stopped. + * This means that if + * 1) work was queued in the workqueue, it was removed from the + * workqueue and suspend proceeded. + * 2) The work was scheduled and cfg80211 suspend waited for this + * work to complete and then suspend proceeded. + * So here in cfg80211 resume, check if no interface is up and + * the module state is enabled then trigger idle timer start. + */ + if (!hdd_is_any_interface_open(hdd_ctx) && + hdd_ctx->driver_status == DRIVER_MODULES_ENABLED) + hdd_psoc_idle_timer_start(hdd_ctx); + return errno; }