Browse Source

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
Alan Chen 4 years ago
parent
commit
6ead5beaab
1 changed files with 21 additions and 1 deletions
  1. 21 1
      core/hdd/src/wlan_hdd_driver_ops.c

+ 21 - 1
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;
 }
 
 /**