Browse Source

qcacld-3.0: Add vdev start, stop, and set-key wakelock for runtime PM

There is only vdev start, stop, and set-key wakelocks for system suspend
as of now. Add vdev start, stop, and set-key wakelocks for runtime PM
also.

Change-Id: Ic071bcfb112ae8861a446298677d190484f0c01b
CRs-Fixed: 2507852
Alan Chen 5 years ago
parent
commit
34250b7fe7

+ 6 - 0
core/wma/inc/wma.h

@@ -757,6 +757,9 @@ struct roam_synch_frame_ind {
  * @vdev_start_wakelock: wakelock to protect vdev start op with firmware
  * @vdev_stop_wakelock: wakelock to protect vdev stop op with firmware
  * @vdev_set_key_wakelock: wakelock to protect vdev set key op with firmware
+ * @vdev_start_runtime_wakelock: runtime pm wakelock for vdev start
+ * @vdev_stop_runtime_wakelock: runtime pm wakelock for vdev stop
+ * @vdev_set_key_runtime_wakelock: runtime pm wakelock for set key
  * @channel: channel
  * @roam_offload_enabled: is roam offload enable/disable
  * @roam_scan_stats_req: cached roam scan stats request
@@ -826,6 +829,9 @@ struct wma_txrx_node {
 	qdf_wake_lock_t vdev_start_wakelock;
 	qdf_wake_lock_t vdev_stop_wakelock;
 	qdf_wake_lock_t vdev_set_key_wakelock;
+	qdf_runtime_lock_t vdev_start_runtime_wakelock;
+	qdf_runtime_lock_t vdev_stop_runtime_wakelock;
+	qdf_runtime_lock_t vdev_set_key_runtime_wakelock;
 	struct roam_synch_frame_ind roam_synch_frame_ind;
 	bool is_waiting_for_key;
 	bool roam_offload_enabled;

+ 2 - 0
core/wma/src/wma_dev_if.c

@@ -2396,6 +2396,8 @@ __wma_handle_vdev_stop_rsp(wmi_vdev_stopped_event_fixed_param *resp_event)
 
 	/* Clear key information */
 	wma_clear_iface_key(iface);
+	qdf_runtime_pm_allow_suspend(
+			&iface->vdev_stop_runtime_wakelock);
 	wma_release_wakelock(&iface->vdev_stop_wakelock);
 
 	req_msg = wma_find_vdev_req(wma, resp_event->vdev_id,

+ 2 - 0
core/wma/src/wma_features.c

@@ -5399,6 +5399,8 @@ void wma_update_set_key(uint8_t session_id, bool pairwise,
 	if (!pairwise && iface) {
 		/* Its GTK release the wake lock */
 		wma_debug("Release set key wake lock");
+		qdf_runtime_pm_allow_suspend(
+				&iface->vdev_set_key_runtime_wakelock);
 		wma_release_wakelock(&iface->vdev_set_key_wakelock);
 	}
 

+ 8 - 2
core/wma/src/wma_main.c

@@ -2863,8 +2863,11 @@ static int wma_unified_phyerr_rx_event_handler(void *handle,
 void wma_vdev_init(struct wma_txrx_node *vdev)
 {
 	qdf_wake_lock_create(&vdev->vdev_start_wakelock, "vdev_start");
+	qdf_runtime_lock_init(&vdev->vdev_start_runtime_wakelock);
 	qdf_wake_lock_create(&vdev->vdev_stop_wakelock, "vdev_stop");
+	qdf_runtime_lock_init(&vdev->vdev_stop_runtime_wakelock);
 	qdf_wake_lock_create(&vdev->vdev_set_key_wakelock, "vdev_set_key");
+	qdf_runtime_lock_init(&vdev->vdev_set_key_runtime_wakelock);
 	vdev->is_waiting_for_key = false;
 }
 
@@ -2943,9 +2946,12 @@ void wma_vdev_deinit(struct wma_txrx_node *vdev)
 		vdev->roam_synch_frame_ind.reassoc_rsp = NULL;
 	}
 
-	qdf_wake_lock_destroy(&vdev->vdev_start_wakelock);
-	qdf_wake_lock_destroy(&vdev->vdev_stop_wakelock);
+	qdf_runtime_lock_deinit(&vdev->vdev_set_key_runtime_wakelock);
 	qdf_wake_lock_destroy(&vdev->vdev_set_key_wakelock);
+	qdf_runtime_lock_deinit(&vdev->vdev_stop_runtime_wakelock);
+	qdf_wake_lock_destroy(&vdev->vdev_stop_wakelock);
+	qdf_runtime_lock_deinit(&vdev->vdev_start_runtime_wakelock);
+	qdf_wake_lock_destroy(&vdev->vdev_start_wakelock);
 	vdev->is_waiting_for_key = false;
 }
 

+ 4 - 0
core/wma/src/wma_mgmt.c

@@ -1471,6 +1471,8 @@ QDF_STATUS wma_send_peer_assoc(tp_wma_handle wma,
 			WMA_VDEV_SET_KEY_WAKELOCK_TIMEOUT);
 		wma_acquire_wakelock(&intr->vdev_set_key_wakelock,
 			WMA_VDEV_SET_KEY_WAKELOCK_TIMEOUT);
+		qdf_runtime_pm_prevent_suspend(
+			&intr->vdev_set_key_runtime_wakelock);
 	}
 	if (params->wpa_rsn >> 1)
 		cmd->need_gtk_2_way = 1;
@@ -2172,6 +2174,8 @@ static QDF_STATUS wma_setup_install_key_cmd(tp_wma_handle wma_handle,
 	if (!key_params->unicast) {
 		/* Its GTK release the wake lock */
 		WMA_LOGD("Release set key wake lock");
+		qdf_runtime_pm_allow_suspend(
+				&iface->vdev_set_key_runtime_wakelock);
 		wma_release_wakelock(&iface->vdev_set_key_wakelock);
 	}
 

+ 13 - 2
core/wma/src/wma_utils.c

@@ -3457,9 +3457,13 @@ wma_send_vdev_start_to_fw(t_wma_handle *wma, struct vdev_start_params *params)
 	}
 	wma_acquire_wakelock(&vdev->vdev_start_wakelock,
 			     WMA_VDEV_START_REQUEST_TIMEOUT);
+	qdf_runtime_pm_prevent_suspend(&vdev->vdev_start_runtime_wakelock);
 	status = wmi_unified_vdev_start_send(wma->wmi_handle, params);
-	if (QDF_IS_STATUS_ERROR(status))
+	if (QDF_IS_STATUS_ERROR(status)) {
+		qdf_runtime_pm_allow_suspend(
+				&vdev->vdev_start_runtime_wakelock);
 		wma_release_wakelock(&vdev->vdev_start_wakelock);
+	}
 
 	return status;
 }
@@ -3486,9 +3490,14 @@ QDF_STATUS wma_send_vdev_stop_to_fw(t_wma_handle *wma, uint8_t vdev_id)
 		     sizeof(struct wlan_mlme_nss_chains));
 	wma_acquire_wakelock(&iface->vdev_stop_wakelock,
 			     WMA_VDEV_STOP_REQUEST_TIMEOUT);
+	qdf_runtime_pm_prevent_suspend(
+			&iface->vdev_stop_runtime_wakelock);
 	status = wmi_unified_vdev_stop_send(wma->wmi_handle, vdev_id);
-	if (QDF_IS_STATUS_ERROR(status))
+	if (QDF_IS_STATUS_ERROR(status)) {
+		qdf_runtime_pm_allow_suspend(
+				&iface->vdev_stop_runtime_wakelock);
 		wma_release_wakelock(&iface->vdev_stop_wakelock);
+	}
 
 	return status;
 }
@@ -3714,6 +3723,7 @@ QDF_STATUS wma_send_vdev_up_to_fw(t_wma_handle *wma,
 	vdev = &wma->interfaces[params->vdev_id];
 
 	status = wmi_unified_vdev_up_send(wma->wmi_handle, bssid, params);
+	qdf_runtime_pm_allow_suspend(&vdev->vdev_start_runtime_wakelock);
 	wma_release_wakelock(&vdev->vdev_start_wakelock);
 
 	return status;
@@ -3733,6 +3743,7 @@ QDF_STATUS wma_send_vdev_down_to_fw(t_wma_handle *wma, uint8_t vdev_id)
 	vdev = &wma->interfaces[vdev_id];
 	wma->interfaces[vdev_id].roaming_in_progress = false;
 	status = wmi_unified_vdev_down_send(wma->wmi_handle, vdev_id);
+	qdf_runtime_pm_allow_suspend(&vdev->vdev_start_runtime_wakelock);
 	wma_release_wakelock(&vdev->vdev_start_wakelock);
 
 	return status;