Browse Source

qcacld-3.0: Hold wake lock for OEM data command

For OEM data command, if there runtime suspend before the response
comes back, the response will not come to host and host will timeout.

To fix this issue, acquire the RTPM wakelock for OEM data command
till the response comes to host.

Change-Id: Ibb52d2b1e24e1e478cf4fb7c8c0d59438e0bbba8
CRs-Fixed: 3571769
Vinod Kumar Myadam 1 year ago
parent
commit
9d6b62d993
3 changed files with 7 additions and 1 deletions
  1. 2 0
      core/hdd/inc/wlan_hdd_main.h
  2. 2 0
      core/hdd/src/wlan_hdd_main.c
  3. 3 1
      core/hdd/src/wlan_hdd_oemdata.c

+ 2 - 0
core/hdd/inc/wlan_hdd_main.h

@@ -959,6 +959,7 @@ struct hdd_chan_change_params {
  * @system_suspend: system suspend context to prevent/allow runtime pm
  * @dyn_mac_addr_update: update mac addr context to prevent/allow runtime pm
  * @vdev_destroy: vdev destroy context to prevent/allow runtime pm
+ * @oem_data_cmd: OEM data context to prevent/allow runtime pm
  *
  * Runtime PM control for underlying activities
  */
@@ -972,6 +973,7 @@ struct hdd_runtime_pm_context {
 	qdf_runtime_lock_t system_suspend;
 	qdf_runtime_lock_t dyn_mac_addr_update;
 	qdf_runtime_lock_t vdev_destroy;
+	qdf_runtime_lock_t oem_data_cmd;
 };
 
 /*

+ 2 - 0
core/hdd/src/wlan_hdd_main.c

@@ -1410,6 +1410,7 @@ static void hdd_runtime_suspend_context_init(struct hdd_context *hdd_ctx)
 	qdf_runtime_lock_init(&ctx->system_suspend);
 	qdf_runtime_lock_init(&ctx->dyn_mac_addr_update);
 	qdf_runtime_lock_init(&ctx->vdev_destroy);
+	qdf_runtime_lock_init(&ctx->oem_data_cmd);
 
 	qdf_rtpm_register(QDF_RTPM_ID_WIPHY_SUSPEND, NULL);
 	qdf_rtpm_register(QDF_RTPM_ID_PM_QOS_NOTIFY, NULL);
@@ -1432,6 +1433,7 @@ static void hdd_runtime_suspend_context_deinit(struct hdd_context *hdd_ctx)
 	if (ctx->is_user_wakelock_acquired)
 		qdf_runtime_pm_allow_suspend(&ctx->user);
 
+	qdf_runtime_lock_deinit(&ctx->oem_data_cmd);
 	qdf_runtime_lock_deinit(&ctx->dyn_mac_addr_update);
 	qdf_runtime_lock_deinit(&ctx->wow_unit_test);
 	qdf_runtime_lock_deinit(&ctx->monitor_mode);

+ 3 - 1
core/hdd/src/wlan_hdd_oemdata.c

@@ -1409,7 +1409,8 @@ __wlan_hdd_cfg80211_oem_data_handler(struct wiphy *wiphy,
 		int skb_len = 0;
 
 		adapter->oem_data_in_progress = true;
-
+		qdf_runtime_pm_prevent_suspend(
+					&hdd_ctx->runtime_context.oem_data_cmd);
 		request = osif_request_alloc(&params);
 		if (!request) {
 			hdd_err("request allocation failure");
@@ -1470,6 +1471,7 @@ err:
 		osif_request_put(request);
 	adapter->oem_data_in_progress = false;
 	adapter->response_expected = false;
+	qdf_runtime_pm_allow_suspend(&hdd_ctx->runtime_context.oem_data_cmd);
 
 	return ret;