Browse Source

qcacld-3.0: Abort system suspend when idle restart occurs

Wifi turn-on will timeout and fail if system suspend occurs during idle
restart. To solve this, abort system suspend during idle restart.

Change-Id: I0a4a1fc9525b5fb19f51a289ca0b8a76c73038e6
CRs-Fixed: 2506716
Alan Chen 5 years ago
parent
commit
32c6048ab6

+ 2 - 1
core/hdd/inc/wlan_hdd_driver_ops.h

@@ -120,12 +120,13 @@ int hdd_hif_open(struct device *dev, void *bdev, const struct hif_bus_id *bid,
 
 /**
  * hdd_soc_idle_restart_lock() - Takes wakelock for idle restart
+ * @dev: wlan device structure
  *
  * This function takes wakelock to prevent suspend during idle restart
  *
  * Return: none
  */
-void hdd_soc_idle_restart_lock(void);
+void hdd_soc_idle_restart_lock(struct device *dev);
 
 /**
  * hdd_soc_idle_restart_unlock() - Releases wakelock for idle restart

+ 13 - 1
core/hdd/src/wlan_hdd_driver_ops.c

@@ -375,8 +375,20 @@ static int check_for_probe_defer(int ret)
 }
 #endif
 
-void hdd_soc_idle_restart_lock(void)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0))
+static void hdd_abort_system_suspend(struct device *dev)
 {
+	pm_wakeup_hard_event(dev);
+}
+#else
+static void hdd_abort_system_suspend(struct device *dev)
+{
+}
+#endif
+
+void hdd_soc_idle_restart_lock(struct device *dev)
+{
+	hdd_abort_system_suspend(dev);
 	hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_IDLE_RESTART);
 }
 

+ 3 - 3
core/hdd/src/wlan_hdd_main.c

@@ -9692,7 +9692,7 @@ static int __hdd_psoc_idle_restart(struct hdd_context *hdd_ctx)
 {
 	int ret;
 
-	hdd_soc_idle_restart_lock();
+	hdd_soc_idle_restart_lock(hdd_ctx->parent_dev);
 
 	ret = hdd_wlan_start_modules(hdd_ctx, false);
 
@@ -9725,7 +9725,7 @@ int hdd_trigger_psoc_idle_restart(struct hdd_context *hdd_ctx)
 		return 0;
 	}
 
-	hdd_soc_idle_restart_lock();
+	hdd_soc_idle_restart_lock(hdd_ctx->parent_dev);
 	ret = pld_idle_restart(hdd_ctx->parent_dev, hdd_psoc_idle_restart);
 	hdd_soc_idle_restart_unlock();
 
@@ -14027,7 +14027,7 @@ static int hdd_mode_change_psoc_idle_restart(struct device *dev)
 
 	if (!hdd_ctx)
 		return -EINVAL;
-	hdd_soc_idle_restart_lock();
+	hdd_soc_idle_restart_lock(dev);
 	ret = hdd_wlan_start_modules(hdd_ctx, false);
 	hdd_soc_idle_restart_unlock();