From 6ead5beaab6a07d33e9a69ae9291eaba817a6a4b Mon Sep 17 00:00:00 2001 From: Alan Chen Date: Tue, 9 Jun 2020 12:42:28 -0700 Subject: [PATCH] qcacld-3.0: Add a wakelock and prevent suspend during idle shutdown System suspend is occurring a few seconds before idle shutdown while it was set to deinit state. Add a wakelock and prevent suspend during idle shutdown. Change-Id: I976bdece04857045e272c5c3e26db51fb63c51cf CRs-Fixed: 2706275 --- core/hdd/src/wlan_hdd_driver_ops.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c index 7347fd99d9d0..aa4b67a6b639 100644 --- a/core/hdd/src/wlan_hdd_driver_ops.c +++ b/core/hdd/src/wlan_hdd_driver_ops.c @@ -1523,6 +1523,18 @@ static void wlan_hdd_pld_remove(struct device *dev, enum pld_bus_type bus_type) hdd_exit(); } +static void hdd_soc_idle_shutdown_lock(struct device *dev) +{ + hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_IDLE_SHUTDOWN); + + hdd_abort_system_suspend(dev); +} + +static void hdd_soc_idle_shutdown_unlock(void) +{ + hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_IDLE_SHUTDOWN); +} + /** * wlan_hdd_pld_idle_shutdown() - wifi module idle shutdown after interface * inactivity timeout has trigerred idle shutdown @@ -1534,7 +1546,15 @@ static void wlan_hdd_pld_remove(struct device *dev, enum pld_bus_type bus_type) static int wlan_hdd_pld_idle_shutdown(struct device *dev, enum pld_bus_type bus_type) { - return hdd_psoc_idle_shutdown(dev); + int ret; + + hdd_soc_idle_shutdown_lock(dev); + + ret = hdd_psoc_idle_shutdown(dev); + + hdd_soc_idle_shutdown_unlock(); + + return ret; } /**