qcacld-3.0: Add Suspend and Resume support in PMO

Add Suspend and Resume support in PMO.

Change-Id: Iba16643adf1cbd997138c740345e40c00c8e81f6
Crs-Fixed: 2015366
diff --git a/Kbuild b/Kbuild
index f53a07b..143a9ba 100644
--- a/Kbuild
+++ b/Kbuild
@@ -842,6 +842,8 @@
 		$(PMO_DIR)/core/src/wlan_pmo_mc_addr_filtering.o \
 		$(PMO_DIR)/core/src/wlan_pmo_static_config.o \
 		$(PMO_DIR)/core/src/wlan_pmo_wow.o \
+		$(PMO_DIR)/core/src/wlan_pmo_lphb.o \
+		$(PMO_DIR)/core/src/wlan_pmo_suspend_resume.o \
 		$(PMO_DIR)/dispatcher/src/wlan_pmo_obj_mgmt_api.o \
 		$(PMO_DIR)/dispatcher/src/wlan_pmo_ucfg_api.o \
 		$(PMO_DIR)/dispatcher/src/wlan_pmo_tgt_arp.o \
@@ -849,7 +851,9 @@
 		$(PMO_DIR)/dispatcher/src/wlan_pmo_tgt_gtk.o \
 		$(PMO_DIR)/dispatcher/src/wlan_pmo_tgt_wow.o \
 		$(PMO_DIR)/dispatcher/src/wlan_pmo_tgt_static_config.o \
-		$(PMO_DIR)/dispatcher/src/wlan_pmo_tgt_mc_addr_filtering.o
+		$(PMO_DIR)/dispatcher/src/wlan_pmo_tgt_mc_addr_filtering.o \
+		$(PMO_DIR)/dispatcher/src/wlan_pmo_tgt_lphb.o \
+		$(PMO_DIR)/dispatcher/src/wlan_pmo_tgt_suspend_resume.o
 
 ###### UMAC POLICY MGR ########
 UMAC_POLICY_MGR_DIR := $(WLAN_COMMON_ROOT)/umac/cmn_services/policy_mgr
@@ -890,7 +894,9 @@
 		$(TARGET_IF_DIR)/pmo/src/target_if_pmo_gtk.o \
 		$(TARGET_IF_DIR)/pmo/src/target_if_pmo_wow.o \
 		$(TARGET_IF_DIR)/pmo/src/target_if_pmo_mc_addr_filtering.o \
-		$(TARGET_IF_DIR)/pmo/src/target_if_pmo_static_config.o
+		$(TARGET_IF_DIR)/pmo/src/target_if_pmo_static_config.o \
+		$(TARGET_IF_DIR)/pmo/src/target_if_pmo_lphb.o \
+		$(TARGET_IF_DIR)/pmo/src/target_if_pmo_suspend_resume.o
 
 ########### GLOBAL_LMAC_IF ##########
 GLOBAL_LMAC_IF_DIR := $(WLAN_COMMON_ROOT)/global_lmac_if
diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c
index 24004da..be39a1c 100644
--- a/core/cds/src/cds_api.c
+++ b/core/cds/src/cds_api.c
@@ -376,8 +376,10 @@
 	}
 	htcInfo.pContext = ol_ctx;
 	htcInfo.TargetFailure = ol_target_failure;
-	htcInfo.TargetSendSuspendComplete = wma_target_suspend_acknowledge;
-	htcInfo.target_initial_wakeup_cb = wma_handle_initial_wake_up;
+	htcInfo.TargetSendSuspendComplete =
+		pmo_ucfg_psoc_target_suspend_acknowledge;
+	htcInfo.target_initial_wakeup_cb = pmo_ucfg_psoc_handle_initial_wake_up;
+	htcInfo.target_psoc = (void *)psoc;
 	qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
 
 	/* Create HTC */
@@ -388,6 +390,7 @@
 			  "%s: Failed to Create HTC", __func__);
 		goto err_bmi_close;
 	}
+	pmo_ucfg_psoc_update_htc_handle(psoc, (void *)gp_cds_context->htc_ctx);
 
 	if (bmi_done(ol_ctx)) {
 		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
@@ -837,7 +840,7 @@
 {
 	QDF_STATUS status;
 	/* Suspend the target and disable interrupt */
-	status = wma_suspend_target(wma_handle, 0);
+	status = pmo_ucfg_psoc_suspend_target(wma_handle->psoc, 0);
 	if (status)
 		cds_err("Failed to suspend target, status = %d", status);
 }
@@ -846,7 +849,7 @@
 {
 	QDF_STATUS status;
 	/* Suspend the target and disable interrupt */
-	status = wma_suspend_target(wma_handle, 1);
+	status = pmo_ucfg_psoc_suspend_target(wma_handle->psoc, 1);
 	if (status)
 		cds_err("Failed to suspend target, status = %d", status);
 }
@@ -917,6 +920,7 @@
 	if (gp_cds_context->htc_ctx) {
 		htc_stop(gp_cds_context->htc_ctx);
 		htc_destroy(gp_cds_context->htc_ctx);
+		pmo_ucfg_psoc_update_htc_handle(psoc, NULL);
 		gp_cds_context->htc_ctx = NULL;
 	}
 
diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c
index c392067..2ab1c39 100644
--- a/core/hdd/src/wlan_hdd_driver_ops.c
+++ b/core/hdd/src/wlan_hdd_driver_ops.c
@@ -549,6 +549,8 @@
 	int err;
 	int status;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
+	QDF_STATUS qdf_status;
+	struct pmo_wow_enable_params *params = NULL;
 
 	hdd_info("starting bus suspend; event:%d", state.event);
 
@@ -576,7 +578,16 @@
 		goto done;
 	}
 
-	err = wma_bus_suspend(wow_params);
+	params = (struct pmo_wow_enable_params *)qdf_mem_malloc(
+			sizeof(*params));
+	if (!params) {
+		hdd_err("params is Null");
+		err = -ENOMEM;
+		goto done;
+	}
+	qdf_status = pmo_ucfg_psoc_bus_suspend_req(hdd_ctx->hdd_psoc,
+			QDF_SYSTEM_SUSPEND, params);
+	err = qdf_status_to_os_return(qdf_status);
 	if (err) {
 		hdd_err("Failed wma bus suspend");
 		goto resume_oltxrx;
@@ -592,12 +603,15 @@
 	return 0;
 
 resume_wma:
-	status = wma_bus_resume();
-	QDF_BUG(!status);
+	qdf_status = pmo_ucfg_psoc_bus_resume_req(hdd_ctx->hdd_psoc,
+			QDF_SYSTEM_SUSPEND);
+	QDF_BUG(!qdf_status);
 resume_oltxrx:
 	status = cdp_bus_resume(soc);
 	QDF_BUG(!status);
 done:
+	if (params)
+		qdf_mem_free(params);
 	hdd_err("suspend failed, status = %d", err);
 	return err;
 }
@@ -666,7 +680,8 @@
 	if (err)
 		goto done;
 
-	err = wma_is_target_wake_up_received();
+	err = pmo_ucfg_psoc_is_target_wake_up_received(
+			hdd_ctx->hdd_psoc);
 	if (err)
 		goto resume_hif_noirq;
 
@@ -749,7 +764,9 @@
 		goto out;
 	}
 
-	status = wma_bus_resume();
+	qdf_status = pmo_ucfg_psoc_bus_resume_req(hdd_ctx->hdd_psoc,
+			QDF_SYSTEM_SUSPEND);
+	status = qdf_status_to_os_return(qdf_status);
 	if (status) {
 		hdd_err("Failed wma bus resume");
 		goto out;
@@ -799,6 +816,7 @@
 	hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
 	void *hif_ctx;
 	int status;
+	QDF_STATUS qdf_status;
 
 	if (cds_is_driver_recovering())
 		return 0;
@@ -818,8 +836,8 @@
 	if (NULL == hif_ctx)
 		return -EINVAL;
 
-	status = wma_clear_target_wake_up();
-	QDF_BUG(!status);
+	qdf_status = pmo_ucfg_psoc_clear_target_wake_up(hdd_ctx->hdd_psoc);
+	QDF_BUG(!qdf_status);
 
 	status = hif_bus_resume_noirq(hif_ctx);
 	QDF_BUG(!status);
diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c
index 6a59be5..4be1736 100644
--- a/core/hdd/src/wlan_hdd_power.c
+++ b/core/hdd/src/wlan_hdd_power.c
@@ -975,57 +975,6 @@
 }
 
 /**
- * hdd_conf_suspend_ind() - Send Suspend notification
- * @pHddCtx: HDD Global context
- * @pAdapter: adapter being suspended
- * @callback: callback function to be called upon completion
- * @callbackContext: callback context to be passed back to callback function
- *
- * Return: None.
- */
-static void hdd_send_suspend_ind(hdd_context_t *pHddCtx,
-				uint32_t conn_state_mask,
-				 void (*callback)(void *callbackContext,
-						  bool suspended),
-				 void *callbackContext)
-{
-	QDF_STATUS qdf_ret_status = QDF_STATUS_E_FAILURE;
-
-	hdd_info("send wlan suspend indication");
-
-	qdf_ret_status =
-		sme_configure_suspend_ind(pHddCtx->hHal, conn_state_mask,
-					  callback, callbackContext);
-
-	if (QDF_STATUS_SUCCESS != qdf_ret_status)
-		hdd_err("sme_configure_suspend_ind returned failure %d",
-		       qdf_ret_status);
-}
-
-/**
- * hdd_conf_suspend_ind() - Send Resume notification
- * @pAdapter: adapter being resumed
- *
- * Return: None.
- */
-static void hdd_conf_resume_ind(hdd_adapter_t *pAdapter)
-{
-	hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-	QDF_STATUS qdf_ret_status = QDF_STATUS_E_FAILURE;
-
-	qdf_ret_status = sme_configure_resume_req(pHddCtx->hHal, NULL);
-
-	if (QDF_STATUS_SUCCESS != qdf_ret_status) {
-		hdd_err("sme_configure_resume_req return failure %d", qdf_ret_status);
-
-	}
-
-	hdd_notice("send wlan resume indication");
-	/* Disable supported OffLoads */
-	hdd_disable_host_offloads(pAdapter, pmo_apps_resume);
-}
-
-/**
  * hdd_update_conn_state_mask(): record info needed by wma_suspend_req
  * @adapter: adapter to get info from
  * @conn_state_mask: mask of connection info
@@ -1051,11 +1000,10 @@
  * @callback: Callback function to invoke when driver is ready to suspend
  * @callbackContext: Context to pass back to @callback function
  *
- * Return: None.
+ * Return: 0 on success else error code.
  */
-static void
-hdd_suspend_wlan(void (*callback)(void *callbackContext, bool suspended),
-		 void *callbackContext)
+static int
+hdd_suspend_wlan(void)
 {
 	hdd_context_t *pHddCtx;
 
@@ -1068,18 +1016,22 @@
 	pHddCtx = cds_get_context(QDF_MODULE_ID_HDD);
 	if (!pHddCtx) {
 		hdd_alert("HDD context is Null");
-		return;
+		return -EINVAL;
 	}
 
 	if (cds_is_driver_recovering()) {
 		hdd_err("Recovery in Progress. State: 0x%x Ignore suspend!!!",
 			 cds_get_driver_state());
-		return;
+		return -EINVAL;
 	}
 
 	status = hdd_get_front_adapter(pHddCtx, &pAdapterNode);
 	while (NULL != pAdapterNode && QDF_STATUS_SUCCESS == status) {
 		pAdapter = pAdapterNode->pAdapter;
+		if (wlan_hdd_validate_session_id(pAdapter->sessionId)) {
+			hdd_err("invalid session id: %d", pAdapter->sessionId);
+			goto next_adapter;
+		}
 
 		/* stop all TX queues before suspend */
 		hdd_notice("Disabling queues");
@@ -1089,27 +1041,28 @@
 		/* Configure supported OffLoads */
 		hdd_enable_host_offloads(pAdapter, pmo_apps_suspend);
 		hdd_update_conn_state_mask(pAdapter, &conn_state_mask);
-
+next_adapter:
 		status = hdd_get_next_adapter(pHddCtx, pAdapterNode, &pNext);
-
 		pAdapterNode = pNext;
 	}
 
-	hdd_send_suspend_ind(pHddCtx, conn_state_mask, callback,
-			callbackContext);
+	status = pmo_ucfg_psoc_user_space_suspend_req(pHddCtx->hdd_psoc,
+			QDF_SYSTEM_SUSPEND);
+	if (status != QDF_STATUS_SUCCESS)
+		return -EAGAIN;
 
 	pHddCtx->hdd_wlan_suspended = true;
 	hdd_wlan_suspend_resume_event(HDD_WLAN_EARLY_SUSPEND);
 
-	return;
+	return 0;
 }
 
 /**
  * hdd_resume_wlan() - Driver resume function
  *
- * Return: None.
+ * Return: 0 on success else error code.
  */
-static void hdd_resume_wlan(void)
+static int hdd_resume_wlan(void)
 {
 	hdd_context_t *pHddCtx;
 	hdd_adapter_t *pAdapter = NULL;
@@ -1121,13 +1074,13 @@
 	pHddCtx = cds_get_context(QDF_MODULE_ID_HDD);
 	if (!pHddCtx) {
 		hdd_err("HDD context is Null");
-		return;
+		return -EINVAL;
 	}
 
 	if (cds_is_driver_recovering()) {
 		hdd_err("Recovery in Progress. State: 0x%x Ignore resume!!!",
 			 cds_get_driver_state());
-		return;
+		return -EINVAL;
 	}
 
 	pHddCtx->hdd_wlan_suspended = false;
@@ -1138,6 +1091,12 @@
 
 	while (NULL != pAdapterNode && QDF_STATUS_SUCCESS == status) {
 		pAdapter = pAdapterNode->pAdapter;
+		if (wlan_hdd_validate_session_id(pAdapter->sessionId)) {
+			hdd_err("invalid session id: %d", pAdapter->sessionId);
+			goto next_adapter;
+		}
+		/* Disable supported OffLoads */
+		hdd_disable_host_offloads(pAdapter, pmo_apps_resume);
 
 		/* wake the tx queues */
 		hdd_info("Enabling queues");
@@ -1145,14 +1104,17 @@
 					WLAN_WAKE_ALL_NETIF_QUEUE,
 					WLAN_CONTROL_PATH);
 
-		hdd_conf_resume_ind(pAdapter);
-
+next_adapter:
 		status = hdd_get_next_adapter(pHddCtx, pAdapterNode, &pNext);
 		pAdapterNode = pNext;
 	}
 	hdd_ipa_resume(pHddCtx);
+	status = pmo_ucfg_psoc_user_space_resume_req(pHddCtx->hdd_psoc,
+			QDF_SYSTEM_SUSPEND);
+	if (status != QDF_STATUS_SUCCESS)
+		return -EAGAIN;
 
-	return;
+	return 0;
 }
 
 /**
@@ -1631,6 +1593,11 @@
 
 	pld_request_bus_bandwidth(pHddCtx->parent_dev, PLD_BUS_WIDTH_MEDIUM);
 
+	status = hdd_resume_wlan();
+	if (status != QDF_STATUS_SUCCESS) {
+		exit_code = 0;
+		goto exit_with_code;
+	}
 	/* Resume control path scheduler */
 	if (pHddCtx->is_scheduler_suspended) {
 		scheduler_resume();
@@ -1643,7 +1610,6 @@
 		pHddCtx->is_ol_rx_thread_suspended = false;
 	}
 #endif
-	hdd_resume_wlan();
 
 	MTRACE(qdf_trace(QDF_MODULE_ID_HDD,
 			 TRACE_CODE_HDD_CFG80211_RESUME_WLAN,
@@ -1698,21 +1664,6 @@
 }
 
 /**
- * wlan_hdd_cfg80211_ready_to_suspend() - set cfg80211 ready to suspend event
- * @callbackContext: Pointer to callback context
- * @suspended: Suspend flag
- *
- * Return: none
- */
-static void wlan_hdd_cfg80211_ready_to_suspend(void *callbackContext,
-						bool suspended)
-{
-	hdd_context_t *pHddCtx = (hdd_context_t *) callbackContext;
-	pHddCtx->suspended = suspended;
-	complete(&pHddCtx->ready_to_suspend);
-}
-
-/**
  * wlan_hdd_cfg80211_resume_wlan() - cfg80211 resume callback
  * @wiphy: Pointer to wiphy
  *
@@ -1878,24 +1829,6 @@
 		return -EAGAIN;
 	}
 
-	/* Wait for the target to be ready for suspend */
-	INIT_COMPLETION(pHddCtx->ready_to_suspend);
-
-	hdd_suspend_wlan(&wlan_hdd_cfg80211_ready_to_suspend, pHddCtx);
-
-	rc = wait_for_completion_timeout(&pHddCtx->ready_to_suspend,
-		msecs_to_jiffies(WLAN_WAIT_TIME_READY_TO_SUSPEND));
-	if (!rc) {
-		hdd_err("Failed to get ready to suspend");
-		goto resume_tx;
-	}
-
-	if (!pHddCtx->suspended) {
-		hdd_err("Faied as suspend_status is wrong:%d",
-			pHddCtx->suspended);
-		goto resume_tx;
-	}
-
 	/* Suspend control path scheduler */
 	scheduler_register_hdd_suspend_callback(hdd_suspend_cb);
 	scheduler_set_event_mask(MC_SUSPEND_EVENT_MASK);
@@ -1909,7 +1842,6 @@
 		hdd_err("Failed to stop mc thread");
 		goto resume_tx;
 	}
-
 	pHddCtx->is_scheduler_suspended = true;
 
 #ifdef QCA_CONFIG_SMP
@@ -1928,6 +1860,9 @@
 	}
 	pHddCtx->is_ol_rx_thread_suspended = true;
 #endif
+	if (hdd_suspend_wlan() < 0)
+		goto resume_all;
+
 	MTRACE(qdf_trace(QDF_MODULE_ID_HDD,
 			 TRACE_CODE_HDD_CFG80211_SUSPEND_WLAN,
 			 NO_SESSION, pHddCtx->isWiphySuspended));
diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h
index 73dc564..d36c5f9 100644
--- a/core/sme/inc/sme_api.h
+++ b/core/sme/inc/sme_api.h
@@ -498,12 +498,6 @@
 		uint16_t frameType, uint8_t *matchData,
 		uint16_t matchLen);
 QDF_STATUS sme_ConfigureAppsCpuWakeupState(tHalHandle hHal, bool isAppsAwake);
-QDF_STATUS sme_configure_suspend_ind(tHalHandle hHal,
-		uint32_t conn_state_mask,
-		csr_readyToSuspendCallback,
-		void *callbackContext);
-QDF_STATUS sme_configure_resume_req(tHalHandle hHal,
-		tpSirWlanResumeParam wlanResumeParam);
 #ifdef WLAN_FEATURE_EXTWOW_SUPPORT
 QDF_STATUS sme_configure_ext_wow(tHalHandle hHal,
 		tpSirExtWoWParams wlanExtParams,
diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c
index 10d815e..53a6a96 100644
--- a/core/sme/src/common/sme_api.c
+++ b/core/sme/src/common/sme_api.c
@@ -6501,109 +6501,6 @@
 	return status;
 }
 
-/* ---------------------------------------------------------------------------
-
-   \fn    sme_configure_suspend_ind
-
-   \brief
-    SME will pass this request to lower mac to Indicate that the wlan needs to
-    be suspended
-
-   \param
-
-    hHal - The handle returned by mac_open.
-
-    wlanSuspendParam- Depicts the wlan suspend params
-
-    csr_readyToSuspendCallback - Callback to be called when ready to suspend
-				 event is received.
-	callback_context  - Context associated with csr_readyToSuspendCallback.
-
-   \return QDF_STATUS
-
-   --------------------------------------------------------------------------- */
-QDF_STATUS sme_configure_suspend_ind(tHalHandle hHal,
-				     uint32_t conn_state_mask,
-				     csr_readyToSuspendCallback callback,
-				     void *callback_context)
-{
-	QDF_STATUS status = QDF_STATUS_SUCCESS;
-	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
-	tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-	struct scheduler_msg message;
-
-	MTRACE(qdf_trace(QDF_MODULE_ID_SME,
-			 TRACE_CODE_SME_RX_HDD_CONFIG_SUSPENDIND, NO_SESSION,
-			 0));
-
-	pMac->readyToSuspendCallback = callback;
-	pMac->readyToSuspendContext = callback_context;
-
-	status = sme_acquire_global_lock(&pMac->sme);
-	if (QDF_IS_STATUS_SUCCESS(status)) {
-		/* serialize the req through MC thread */
-		message.bodyval = conn_state_mask;
-		message.type = WMA_WLAN_SUSPEND_IND;
-		MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG,
-				 NO_SESSION, message.type));
-		qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA,
-						 &message);
-		if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
-			pMac->readyToSuspendCallback = NULL;
-			pMac->readyToSuspendContext = NULL;
-			status = QDF_STATUS_E_FAILURE;
-		}
-		sme_release_global_lock(&pMac->sme);
-	}
-
-	return status;
-}
-
-/* ---------------------------------------------------------------------------
-
-   \fn    sme_configure_resume_req
-
-   \brief
-    SME will pass this request to lower mac to Indicate that the wlan needs to
-    be Resumed
-
-   \param
-
-    hHal - The handle returned by mac_open.
-
-    wlanResumeParam- Depicts the wlan resume params
-
-   \return QDF_STATUS
-
-   --------------------------------------------------------------------------- */
-QDF_STATUS sme_configure_resume_req(tHalHandle hHal,
-				    tpSirWlanResumeParam wlanResumeParam)
-{
-	QDF_STATUS status = QDF_STATUS_SUCCESS;
-	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
-	tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-	struct scheduler_msg message;
-
-	MTRACE(qdf_trace(QDF_MODULE_ID_SME,
-			 TRACE_CODE_SME_RX_HDD_CONFIG_RESUMEREQ, NO_SESSION,
-			 0));
-	status = sme_acquire_global_lock(&pMac->sme);
-	if (QDF_IS_STATUS_SUCCESS(status)) {
-		/* serialize the req through MC thread */
-		message.bodyptr = wlanResumeParam;
-		message.type = WMA_WLAN_RESUME_REQ;
-		MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG,
-				 NO_SESSION, message.type));
-		qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA,
-						 &message);
-		if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
-			status = QDF_STATUS_E_FAILURE;
-		}
-		sme_release_global_lock(&pMac->sme);
-	}
-	return status;
-}
-
 #ifdef WLAN_FEATURE_EXTWOW_SUPPORT
 /**
  * sme_configure_ext_wow() - configure Extr WoW
diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h
index 0cf67ab..fda1395 100644
--- a/core/wma/inc/wma.h
+++ b/core/wma/inc/wma.h
@@ -1479,7 +1479,6 @@
 #endif
 	qdf_wake_lock_t wow_wake_lock;
 	int wow_nack;
-	bool wow_initial_wake_up;
 	qdf_atomic_t is_wow_bus_suspended;
 	qdf_mc_timer_t wma_scan_comp_timer;
 	uint8_t dfs_phyerr_filter_offload;
diff --git a/core/wma/inc/wma_api.h b/core/wma/inc/wma_api.h
index ebe8ba2..fc3ac23 100644
--- a/core/wma/inc/wma_api.h
+++ b/core/wma/inc/wma_api.h
@@ -138,21 +138,6 @@
 int wma_runtime_suspend(struct wow_enable_params wow_params);
 int wma_runtime_resume(void);
 
-int wma_bus_suspend(struct wow_enable_params wow_params);
-int wma_is_target_wake_up_received(void);
-int wma_clear_target_wake_up(void);
-QDF_STATUS wma_suspend_target(WMA_HANDLE handle, int disable_target_intr);
-void wma_target_suspend_acknowledge(void *context, bool wow_nack);
-void wma_handle_initial_wake_up(void);
-int wma_bus_resume(void);
-QDF_STATUS wma_resume_target(WMA_HANDLE handle);
-QDF_STATUS wma_disable_wow_in_fw(WMA_HANDLE handle);
-QDF_STATUS wma_disable_d0wow_in_fw(WMA_HANDLE handle);
-bool wma_is_wow_mode_selected(WMA_HANDLE handle);
-QDF_STATUS wma_enable_wow_in_fw(WMA_HANDLE handle,
-				struct wow_enable_params wow_params);
-QDF_STATUS wma_enable_d0wow_in_fw(WMA_HANDLE handle,
-				  struct wow_enable_params wow_params);
 bool wma_check_scan_in_progress(WMA_HANDLE handle);
 void wma_set_peer_authorized_cb(void *wma_ctx, wma_peer_authorized_fp auth_cb);
 QDF_STATUS wma_set_peer_param(void *wma_ctx, uint8_t *peer_addr,
diff --git a/core/wma/inc/wma_internal.h b/core/wma/inc/wma_internal.h
index 3835f95..6dccb6d 100644
--- a/core/wma/inc/wma_internal.h
+++ b/core/wma/inc/wma_internal.h
@@ -964,18 +964,6 @@
 				     uint32_t len);
 int wma_pdev_resume_event_handler(void *handle, uint8_t *event, uint32_t len);
 
-/**
- * wma_get_wow_bus_suspend() - check is wow bus suspended or not
- * @wma: wma handle
- *
- * Return: true/false
- */
-static inline int wma_get_wow_bus_suspend(tp_wma_handle wma)
-{
-
-	return qdf_atomic_read(&wma->is_wow_bus_suspended);
-}
-
 QDF_STATUS wma_resume_req(tp_wma_handle wma, enum qdf_suspend_type type);
 
 QDF_STATUS wma_wow_add_pattern(tp_wma_handle wma,
@@ -989,6 +977,7 @@
 QDF_STATUS wma_wow_exit(tp_wma_handle wma, tpSirHalWowlExitParams info);
 
 QDF_STATUS wma_suspend_req(tp_wma_handle wma, enum qdf_suspend_type type);
+
 void wma_calculate_and_update_conn_state(tp_wma_handle wma);
 void wma_update_conn_state(tp_wma_handle wma, uint32_t conn_mask);
 void wma_update_conn_state(tp_wma_handle wma, uint32_t conn_mask);
@@ -1121,7 +1110,6 @@
 					   ch_avoid_update_req);
 #endif
 
-QDF_STATUS wma_suspend_target(WMA_HANDLE handle, int disable_target_intr);
 
 #ifdef FEATURE_WLAN_TDLS
 
diff --git a/core/wma/src/wma_data.c b/core/wma/src/wma_data.c
index 2bbc736..13b722c 100644
--- a/core/wma/src/wma_data.c
+++ b/core/wma/src/wma_data.c
@@ -1617,7 +1617,7 @@
 		return -EINVAL;
 	}
 
-	if (wma_get_wow_bus_suspend(wma)) {
+	if (pmo_ucfg_get_wow_bus_suspend(wma->psoc)) {
 		WMA_LOGD(" Suspend is in progress: Pause/Unpause Tx is NoOp");
 		return 0;
 	}
diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c
index 09cf3e2..23c3263 100644
--- a/core/wma/src/wma_features.c
+++ b/core/wma/src/wma_features.c
@@ -2175,38 +2175,6 @@
 }
 #endif /* REMOVE_PKT_LOG */
 
-static void wma_send_status_to_suspend_ind(tp_wma_handle wma, bool suspended)
-{
-	tSirReadyToSuspendInd *ready_to_suspend;
-	QDF_STATUS status;
-	struct scheduler_msg message;
-	uint8_t len;
-
-	WMA_LOGD("Posting ready to suspend indication to umac");
-
-	len = sizeof(tSirReadyToSuspendInd);
-	ready_to_suspend = (tSirReadyToSuspendInd *) qdf_mem_malloc(len);
-
-	if (NULL == ready_to_suspend) {
-		WMA_LOGE("%s: Memory allocation failure", __func__);
-		return;
-	}
-
-	ready_to_suspend->mesgType = eWNI_SME_READY_TO_SUSPEND_IND;
-	ready_to_suspend->mesgLen = len;
-	ready_to_suspend->suspended = suspended;
-
-	message.type = eWNI_SME_READY_TO_SUSPEND_IND;
-	message.bodyptr = (void *)ready_to_suspend;
-	message.bodyval = 0;
-
-	status = scheduler_post_msg(QDF_MODULE_ID_SME, &message);
-	if (status != QDF_STATUS_SUCCESS) {
-		WMA_LOGE("Failed to post ready to suspend");
-		qdf_mem_free(ready_to_suspend);
-	}
-}
-
 /**
  * wma_wow_wake_reason_str() -  Converts wow wakeup reason code to text format
  * @wake_reason - WOW wake reason
@@ -3165,7 +3133,7 @@
 		qdf_wow_wakeup_host_event(wake_info->wake_reason);
 	}
 
-	qdf_event_set(&wma->wma_resume_event);
+	pmo_ucfg_psoc_wakeup_host_event_received(wma->psoc);
 
 	if (param_buf->wow_packet_buffer &&
 	    tlv_check_required(wake_info->wake_reason)) {
@@ -3431,7 +3399,7 @@
 
 	WMA_LOGA("Received PDEV resume event");
 
-	qdf_event_set(&wma->wma_resume_event);
+	pmo_ucfg_psoc_wakeup_host_event_received(wma->psoc);
 
 	return 0;
 }
@@ -3449,144 +3417,18 @@
 }
 
 /**
- * wma_enable_wow_in_fw() - wnable wow in fw
+ * wma_suspend_req() -  Handles suspend indication request received from umac.
  * @wma: wma handle
- * @wow_params: collection of wow enable override parameters
+ * @type: type of suspend
+ *
+ * The type controlls how we notify the indicator that the indication has
+ * been processed
  *
  * Return: QDF status
  */
-QDF_STATUS wma_enable_wow_in_fw(WMA_HANDLE handle,
-				struct wow_enable_params wow_params)
+QDF_STATUS wma_suspend_req(tp_wma_handle wma, enum qdf_suspend_type type)
 {
-	tp_wma_handle wma = handle;
-	int ret;
-	struct hif_opaque_softc *scn;
-	int host_credits;
-	int wmi_pending_cmds;
-	struct wow_cmd_params param = {0};
-
-	tpAniSirGlobal pMac = cds_get_context(QDF_MODULE_ID_PE);
-
-	if (NULL == pMac) {
-		WMA_LOGE("%s: Unable to get PE context", __func__);
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	qdf_event_reset(&wma->target_suspend);
-	wma->wow_nack = false;
-
-	host_credits = wmi_get_host_credits(wma->wmi_handle);
-	wmi_pending_cmds = wmi_get_pending_cmds(wma->wmi_handle);
-
-	WMA_LOGD("Credits:%d; Pending_Cmds: %d",
-		 host_credits, wmi_pending_cmds);
-
-	param.enable = true;
-	if (wow_params.is_unit_test)
-		param.flags = WMI_WOW_FLAG_UNIT_TEST_ENABLE;
-
-	switch (wow_params.interface_pause) {
-	default:
-		WMA_LOGE("Invalid interface pause setting: %d",
-			 wow_params.interface_pause);
-		/* intentional fall-through to default */
-	case WOW_INTERFACE_PAUSE_DEFAULT:
-		param.can_suspend_link = htc_can_suspend_link(wma->htc_handle);
-		break;
-	case WOW_INTERFACE_PAUSE_ENABLE:
-		param.can_suspend_link = true;
-		break;
-	case WOW_INTERFACE_PAUSE_DISABLE:
-		param.can_suspend_link = false;
-		break;
-	}
-
-	switch (wow_params.resume_trigger) {
-	default:
-		WMA_LOGE("Invalid resume trigger setting: %d",
-			 wow_params.resume_trigger);
-		/* intentional fall-through to default */
-	case WOW_RESUME_TRIGGER_DEFAULT:
-	case WOW_RESUME_TRIGGER_GPIO:
-		/*
-		 * GPIO is currently implicit. This means you can't actually
-		 * force GPIO if a platform's default wake trigger is HTC wakeup
-		 */
-		break;
-	case WOW_RESUME_TRIGGER_HTC_WAKEUP:
-		param.flags |= WMI_WOW_FLAG_DO_HTC_WAKEUP;
-		break;
-	}
-
-	ret = wmi_unified_wow_enable_send(wma->wmi_handle, &param,
-				   WMA_WILDCARD_PDEV_ID);
-	if (ret) {
-		WMA_LOGE("Failed to enable wow in fw");
-		goto error;
-	}
-
-	wmi_set_target_suspend(wma->wmi_handle, true);
-
-	if (qdf_wait_single_event(&wma->target_suspend,
-				  WMA_TGT_SUSPEND_COMPLETE_TIMEOUT)
-	    != QDF_STATUS_SUCCESS) {
-		WMA_LOGE("Failed to receive WoW Enable Ack from FW");
-		WMA_LOGE("Credits:%d; Pending_Cmds: %d",
-			 wmi_get_host_credits(wma->wmi_handle),
-			 wmi_get_pending_cmds(wma->wmi_handle));
-		wmi_set_target_suspend(wma->wmi_handle, false);
-		if (!cds_is_driver_recovering()) {
-			if (pMac->sme.enableSelfRecovery) {
-				cds_trigger_recovery(false);
-			} else {
-				QDF_BUG(0);
-			}
-		} else {
-			WMA_LOGE("%s: LOGP is in progress, ignore!", __func__);
-		}
-
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	if (wma->wow_nack) {
-		WMA_LOGE("FW not ready to WOW");
-		wmi_set_target_suspend(wma->wmi_handle, false);
-		return QDF_STATUS_E_AGAIN;
-	}
-
-	host_credits = wmi_get_host_credits(wma->wmi_handle);
-	wmi_pending_cmds = wmi_get_pending_cmds(wma->wmi_handle);
-
-	if (host_credits < WMI_WOW_REQUIRED_CREDITS) {
-		WMA_LOGE("%s: No Credits after HTC ACK:%d, pending_cmds:%d, "
-			 "cannot resume back", __func__, host_credits,
-			 wmi_pending_cmds);
-		htc_dump_counter_info(wma->htc_handle);
-		if (!cds_is_driver_recovering())
-			QDF_BUG(0);
-		else
-			WMA_LOGE("%s: SSR in progress, ignore no credit issue",
-				 __func__);
-	}
-
-	WMA_LOGD("WOW enabled successfully in fw: credits:%d"
-		 "pending_cmds: %d", host_credits, wmi_pending_cmds);
-
-	scn = cds_get_context(QDF_MODULE_ID_HIF);
-
-	if (scn == NULL) {
-		WMA_LOGE("%s: Failed to get HIF context", __func__);
-		wmi_set_target_suspend(wma->wmi_handle, false);
-		QDF_ASSERT(0);
-		return QDF_STATUS_E_FAULT;
-	}
-
-	wma->wow.wow_enable_cmd_sent = true;
-
 	return QDF_STATUS_SUCCESS;
-
-error:
-	return QDF_STATUS_E_FAILURE;
 }
 
 /**
@@ -3598,27 +3440,6 @@
  */
 QDF_STATUS wma_resume_req(tp_wma_handle wma, enum qdf_suspend_type type)
 {
-	if (type == QDF_SYSTEM_SUSPEND) {
-		wma->no_of_resume_ind++;
-
-		if (wma->no_of_resume_ind < wma_get_vdev_count(wma))
-			return QDF_STATUS_SUCCESS;
-
-		wma->no_of_resume_ind = 0;
-	}
-
-	/* Reset the DTIM Parameters */
-	wma_set_resume_dtim(wma);
-	/* need to reset if hif_pci_suspend_fails */
-	wma_set_wow_bus_suspend(wma, 0);
-	/* unpause the vdev if left paused and hif_pci_suspend fails */
-	wma_unpause_vdev(wma);
-
-	wmi_set_runtime_pm_inprogress(wma->wmi_handle, false);
-
-	if (type == QDF_RUNTIME_SUSPEND)
-		qdf_runtime_pm_allow_suspend(wma->wma_runtime_resume_lock);
-
 	return QDF_STATUS_SUCCESS;
 }
 
@@ -3732,456 +3553,6 @@
 }
 
 /**
- * wma_is_beaconning_vdev_up(): check if a beaconning vdev is up
- * @wma: wma handle
- *
- * Return TRUE if beaconning vdev is up
- */
-static inline
-bool wma_is_beaconning_vdev_up(tp_wma_handle wma)
-{
-	int i;
-	for (i = 0; i < wma->max_bssid; i++) {
-		if (wma_is_vdev_in_beaconning_mode(wma, i)
-				&& wma_is_vdev_up(i))
-			return true;
-	}
-	return false;
-}
-
-/**
- * wma_support_wow_for_beaconing: wow query for beaconning
- * @wma: wma handle
- *
- * Need to configure wow to enable beaconning offload when
- * a beaconing vdev is up and beaonning offload is configured.
- *
- * Return: true if we need to enable wow for beaconning offload
- */
-static inline
-bool wma_support_wow_for_beaconing(tp_wma_handle wma)
-{
-	if (WMI_SERVICE_IS_ENABLED(wma->wmi_service_bitmap,
-				WMI_SERVICE_BEACON_OFFLOAD)) {
-		if (wma_is_beaconning_vdev_up(wma))
-			return true;
-	}
-	return false;
-}
-
-#ifdef FEATURE_WLAN_SCAN_PNO
-/**
- * wma_is_pnoscan_in_progress(): check if a pnoscan is in progress
- * @wma: wma handle
- * @vdev_id: vdev_id
- *
- * Return: TRUE/FALSE
- */
-static inline
-bool wma_is_pnoscan_in_progress(tp_wma_handle wma, int vdev_id)
-{
-	return wma->interfaces[vdev_id].pno_in_progress;
-}
-
-/**
- * wma_is_pnoscan_match_found(): check if a scan match was found
- * @wma: wma handle
- * @vdev_id: vdev_id
- *
- * Return: TRUE/FALSE
- */
-static inline
-bool wma_is_pnoscan_match_found(tp_wma_handle wma, int vdev_id)
-{
-	return wma->interfaces[vdev_id].nlo_match_evt_received;
-}
-#else
-/**
- * wma_is_pnoscan_in_progress(): dummy
- *
- * Return: False since no pnoscan cannot be in progress
- * when feature flag is not defined.
- */
-bool wma_is_pnoscan_in_progress(tp_wma_handle wma, int vdev_id)
-{
-	return FALSE;
-}
-
-/**
- * wma_is_pnoscan_match_found(): dummy
- * @wma: wma handle
- * @vdev_id: vdev_id
- *
- * Return: False since no pnoscan cannot occur
- * when feature flag is not defined.
- */
-static inline
-bool wma_is_pnoscan_match_found(tp_wma_handle wma, int vdev_id)
-{
-	return FALSE;
-}
-#endif
-
-#ifdef FEATURE_WLAN_EXTSCAN
-static inline
-/**
- * wma_is_extscan_in_progress(): check if an extscan is in progress
- * @wma: wma handle
- * @vdev_id: vdev_id
- *
- * Return: TRUE/FALSvE
- */
-bool wma_is_extscan_in_progress(tp_wma_handle wma, int vdev_id)
-{
-	return wma->interfaces[vdev_id].extscan_in_progress;
-}
-#else
-/**
- * wma_is_extscan_in_progress(): dummy
- *
- * Return: False since no extscan can be in progress
- * when feature flag is not defined.
- */
-bool wma_is_extscan_in_progress(tp_wma_handle wma, int vdev_id)
-{
-	return false;
-}
-#endif
-
-/**
- * wma_is_p2plo_in_progress(): check if P2P listen offload is in progress
- * @wma: wma handle
- * @vdev_id: vdev_id
- *
- * This function is to check if p2p listen offload is in progress,
- *  true: p2p listen offload in progress
- *  false: otherwise
- *
- * Return: TRUE/FALSE
- */
-static inline
-bool wma_is_p2plo_in_progress(tp_wma_handle wma, int vdev_id)
-{
-	return wma->interfaces[vdev_id].p2p_lo_in_progress;
-}
-
-#ifdef WLAN_FEATURE_LPSS
-/**
- * wma_is_lpass_enabled() - check if lpass is enabled
- * @handle: Pointer to wma handle
- *
- * WoW is needed if LPASS or NaN feature is enabled in INI because
- * target can't wake up itself if its put in PDEV suspend when LPASS
- * or NaN features are supported
- *
- * Return: true if lpass is enabled else false
- */
-bool static wma_is_lpass_enabled(tp_wma_handle wma)
-{
-	if (wma->is_lpass_enabled)
-		return true;
-	else
-		return false;
-}
-#else
-bool static wma_is_lpass_enabled(tp_wma_handle wma)
-{
-	return false;
-}
-#endif
-
-#ifdef WLAN_FEATURE_NAN
-/**
- * wma_is_nan_enabled() - check if NaN is enabled
- * @handle: Pointer to wma handle
- *
- * WoW is needed if LPASS or NaN feature is enabled in INI because
- * target can't wake up itself if its put in PDEV suspend when LPASS
- * or NaN features are supported
- *
- * Return: true if NaN is enabled else false
- */
-bool static wma_is_nan_enabled(tp_wma_handle wma)
-{
-	if (wma->is_nan_enabled)
-		return true;
-	else
-		return false;
-}
-#else
-bool static wma_is_nan_enabled(tp_wma_handle wma)
-{
-	return false;
-}
-#endif
-
-/**
- * wma_is_wow_applicable(): should enable wow
- * @wma: wma handle
- *
- *  Enable WOW if any one of the condition meets,
- *  1) Is any one of vdev in beaconning mode (in AP mode) ?
- *  2) Is any one of vdev in connected state (in STA mode) ?
- *  3) Is PNO in progress in any one of vdev ?
- *  4) Is Extscan in progress in any one of vdev ?
- *  5) Is P2P listen offload in any one of vdev?
- *  6) Is any vdev in NAN data mode? BSS is already started at the
- *     the time of device creation. It is ready to accept data
- *     requests.
- *  7) If LPASS feature is enabled
- *  8) If NaN feature is enabled
- *  If none of above conditions is true then return false
- *
- * Return: true if wma needs to configure wow false otherwise.
- */
-static bool wma_is_wow_applicable(tp_wma_handle wma)
-{
-	int vdev_id;
-	if (wma_support_wow_for_beaconing(wma)) {
-		WMA_LOGD("vdev is in beaconning mode, enabling wow");
-		return true;
-	}
-
-	for (vdev_id = 0; vdev_id < wma->max_bssid; vdev_id++) {
-		if (wma->interfaces[vdev_id].conn_state) {
-			WMA_LOGD("STA is connected, enabling wow");
-			return true;
-		} else if (wma_is_pnoscan_in_progress(wma, vdev_id)) {
-			WMA_LOGD("PNO is in progress, enabling wow");
-			return true;
-		} else if (wma_is_extscan_in_progress(wma, vdev_id)) {
-			WMA_LOGD("EXT is in progress, enabling wow");
-			return true;
-		} else if (wma_is_p2plo_in_progress(wma, vdev_id)) {
-			WMA_LOGD("P2P LO is in progress, enabling wow");
-			return true;
-		} else if (wma_is_lpass_enabled(wma)) {
-			WMA_LOGD("LPASS is enabled, enabling WoW");
-			return true;
-		} else if (wma_is_nan_enabled(wma)) {
-			WMA_LOGD("NAN is enabled, enabling WoW");
-			return true;
-		} else if (WMA_IS_VDEV_IN_NDI_MODE(wma->interfaces, vdev_id)) {
-			WMA_LOGD("vdev %d is in NAN data mode, enabling wow",
-				vdev_id);
-			return true;
-		}
-	}
-
-	WMA_LOGD("All vdev are in disconnected state and pno/extscan is not in progress, skipping wow");
-	return false;
-}
-
-/**
- * wma_configure_dynamic_wake_events(): configure dyanmic wake events
- * @wma: wma handle
- *
- * Some wake events need to be enabled dynamically.  Controll those here.
- *
- * Return: none
- */
-static void wma_configure_dynamic_wake_events(tp_wma_handle wma)
-{
-	int vdev_id;
-	int enable_mask;
-	int disable_mask;
-
-	for (vdev_id = 0; vdev_id < wma->max_bssid; vdev_id++) {
-		enable_mask = 0;
-		disable_mask = 0;
-
-		if (wma_is_pnoscan_in_progress(wma, vdev_id)) {
-			if (wma_is_pnoscan_match_found(wma, vdev_id))
-				enable_mask |=
-					(1 << WOW_NLO_SCAN_COMPLETE_EVENT);
-			else
-				disable_mask |=
-					(1 << WOW_NLO_SCAN_COMPLETE_EVENT);
-		}
-
-		if (enable_mask != 0)
-			pmo_ucfg_enable_wakeup_event(wma->psoc, vdev_id,
-				enable_mask);
-		if (disable_mask != 0)
-			pmo_ucfg_disable_wakeup_event(wma->psoc, vdev_id,
-					disable_mask);
-	}
-}
-
-#ifdef FEATURE_WLAN_LPHB
-/**
- * wma_apply_lphb(): apply cached LPHB settings
- * @wma: wma handle
- *
- * LPHB cache, if any item was enabled, should be
- * applied.
- */
-static inline
-void wma_apply_lphb(tp_wma_handle wma)
-{
-	int i;
-	WMA_LOGD("%s: checking LPHB cache", __func__);
-	for (i = 0; i < 2; i++) {
-		if (wma->wow.lphb_cache[i].params.lphbEnableReq.enable) {
-			WMA_LOGD("%s: LPHB cache for item %d is marked as enable",
-				__func__, i + 1);
-			wma_lphb_conf_hbenable(wma, &(wma->wow.lphb_cache[i]),
-					       false);
-		}
-	}
-}
-#else
-void wma_apply_lphb(tp_wma_handle wma) {}
-#endif /* FEATURE_WLAN_LPHB */
-
-static void wma_notify_suspend_req_procesed(tp_wma_handle wma,
-		enum qdf_suspend_type type)
-{
-	if (type == QDF_SYSTEM_SUSPEND)
-		wma_send_status_to_suspend_ind(wma, true);
-	else if (type == QDF_RUNTIME_SUSPEND)
-		qdf_event_set(&wma->runtime_suspend);
-}
-
-/**
- * wma_suspend_req() -  Handles suspend indication request received from umac.
- * @wma: wma handle
- * @type: type of suspend
- *
- * The type controlls how we notify the indicator that the indication has
- * been processed
- *
- * Return: QDF status
- */
-QDF_STATUS wma_suspend_req(tp_wma_handle wma, enum qdf_suspend_type type)
-{
-	if (type == QDF_RUNTIME_SUSPEND)
-		wmi_set_runtime_pm_inprogress(wma->wmi_handle, true);
-
-	if (wma_is_wow_applicable(wma)) {
-		WMA_LOGI("WOW Suspend");
-		wma_apply_lphb(wma);
-
-		wma_configure_dynamic_wake_events(wma);
-
-		wma->wow.wow_enable = true;
-		wma->wow.wow_enable_cmd_sent = false;
-	}
-
-	/* Set the Suspend DTIM Parameters */
-	wma_set_suspend_dtim(wma);
-
-	wma_notify_suspend_req_procesed(wma, type);
-
-	/* to handle race between hif_pci_suspend and
-	 * unpause/pause tx handler
-	 */
-	wma_set_wow_bus_suspend(wma, 1);
-
-	return QDF_STATUS_SUCCESS;
-}
-
-/**
- * wma_send_host_wakeup_ind_to_fw() - send wakeup ind to fw
- * @wma: wma handle
- *
- * Sends host wakeup indication to FW. On receiving this indication,
- * FW will come out of WOW.
- *
- * Return: QDF status
- */
-static QDF_STATUS wma_send_host_wakeup_ind_to_fw(tp_wma_handle wma)
-{
-	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
-	int ret;
-	tpAniSirGlobal pMac = cds_get_context(QDF_MODULE_ID_PE);
-	if (NULL == pMac) {
-		WMA_LOGE("%s: Unable to get PE context", __func__);
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	qdf_event_reset(&wma->wma_resume_event);
-
-	ret = wmi_unified_host_wakeup_ind_to_fw_cmd(wma->wmi_handle);
-	if (ret) {
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	WMA_LOGD("Host wakeup indication sent to fw");
-
-	qdf_status = qdf_wait_single_event(&(wma->wma_resume_event),
-					   WMA_RESUME_TIMEOUT);
-	if (QDF_STATUS_SUCCESS != qdf_status) {
-		WMA_LOGP("%s: Timeout waiting for resume event from FW",
-			 __func__);
-		WMA_LOGP("%s: Pending commands %d credits %d", __func__,
-			 wmi_get_pending_cmds(wma->wmi_handle),
-			 wmi_get_host_credits(wma->wmi_handle));
-		if (!cds_is_driver_recovering()) {
-			if (pMac->sme.enableSelfRecovery) {
-				wmi_tag_crash_inject(wma->wmi_handle, true);
-				cds_trigger_recovery(false);
-			} else {
-				QDF_BUG(0);
-			}
-		} else {
-			WMA_LOGE("%s: SSR in progress, ignore resume timeout",
-				 __func__);
-		}
-	} else {
-		WMA_LOGD("Host wakeup received");
-	}
-
-	if (QDF_STATUS_SUCCESS == qdf_status)
-		wmi_set_target_suspend(wma->wmi_handle, false);
-
-	return qdf_status;
-}
-
-/**
- * wma_disable_wow_in_fw() -  Disable wow in PCIe resume context.
- * @handle: wma handle
- *
- * Return: 0 for success or error code
- */
-QDF_STATUS wma_disable_wow_in_fw(WMA_HANDLE handle)
-{
-	tp_wma_handle wma = handle;
-	QDF_STATUS ret;
-
-	ret = wma_send_host_wakeup_ind_to_fw(wma);
-
-	if (ret != QDF_STATUS_SUCCESS)
-		return ret;
-
-	wma->wow.wow_enable = false;
-	wma->wow.wow_enable_cmd_sent = false;
-
-	/* To allow the tx pause/unpause events */
-	wma_set_wow_bus_suspend(wma, 0);
-	/* Unpause the vdev as we are resuming */
-	wma_unpause_vdev(wma);
-
-	return ret;
-}
-
-
-/**
- * wma_is_wow_mode_selected() - check if wow needs to be enabled in fw
- * @handle: Pointer to wma handle
- *
- * If lpass is enabled then always do wow else check wow_enable config
- *
- * Return: true is wow mode is needed else false
- */
-bool wma_is_wow_mode_selected(WMA_HANDLE handle)
-{
-	tp_wma_handle wma = (tp_wma_handle) handle;
-	WMA_LOGD("WoW enable %d", wma->wow.wow_enable);
-	return wma->wow.wow_enable;
-}
-
-/**
  * wma_del_ts_req() - send DELTS request to fw
  * @wma: wma handle
  * @msg: delts params
@@ -5486,45 +4857,6 @@
 }
 
 /**
- * wma_post_runtime_suspend_msg() - post the suspend request
- * @handle: validated wma handle
- *
- * Requests for offloads to be configured for runtime suspend
- * on the MC thread
- *
- * Return QDF_STATUS_E_AGAIN in case of timeout or QDF_STATUS_SUCCESS
- */
-static QDF_STATUS wma_post_runtime_suspend_msg(WMA_HANDLE handle)
-{
-	struct scheduler_msg message;
-	QDF_STATUS qdf_status;
-	tp_wma_handle wma = (tp_wma_handle) handle;
-
-	qdf_event_reset(&wma->runtime_suspend);
-
-	message.bodyptr = NULL;
-	message.type    = WMA_RUNTIME_PM_SUSPEND_IND;
-	qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, &message);
-
-	if (qdf_status != QDF_STATUS_SUCCESS)
-		goto failure;
-
-	if (qdf_wait_single_event(&wma->runtime_suspend,
-			WMA_TGT_SUSPEND_COMPLETE_TIMEOUT) !=
-			QDF_STATUS_SUCCESS) {
-		WMA_LOGE("Failed to get runtime suspend event");
-		goto msg_timed_out;
-	}
-
-	return QDF_STATUS_SUCCESS;
-
-msg_timed_out:
-	wma_post_runtime_resume_msg(wma);
-failure:
-	return QDF_STATUS_E_AGAIN;
-}
-
-/**
  * __wma_bus_suspend(): handles bus suspend for wma
  * @type: is this suspend part of runtime suspend or system suspend?
  * @wow_params: collection of wow enable override parameters
@@ -5537,33 +4869,7 @@
 static int __wma_bus_suspend(enum qdf_suspend_type type,
 			     struct wow_enable_params wow_params)
 {
-	WMA_HANDLE handle = cds_get_context(QDF_MODULE_ID_WMA);
-	if (NULL == handle) {
-		WMA_LOGE("%s: wma context is NULL", __func__);
-		return -EFAULT;
-	}
-
-	if (wma_check_scan_in_progress(handle)) {
-		WMA_LOGE("%s: Scan in progress. Aborting suspend", __func__);
-		return -EBUSY;
-	}
-
-	if (type == QDF_RUNTIME_SUSPEND) {
-		QDF_STATUS status = wma_post_runtime_suspend_msg(handle);
-		if (status)
-			return qdf_status_to_os_return(status);
-	}
-
-	if (type == QDF_SYSTEM_SUSPEND)
-		WMA_LOGI("%s: wow mode selected %d", __func__,
-				wma_is_wow_mode_selected(handle));
-
-	if (wma_is_wow_mode_selected(handle)) {
-		QDF_STATUS status = wma_enable_wow_in_fw(handle, wow_params);
-		return qdf_status_to_os_return(status);
-	}
-
-	return wma_suspend_target(handle, 0);
+	return 0;
 }
 
 /**
@@ -5586,19 +4892,6 @@
 }
 
 /**
- * wma_bus_suspend() - handles bus suspend request from hdd
- * @wow_params: collection of wow enable override parameters
- *
- * Calls the appropriate handler based on configuration and event
- *
- * Return: 0 for success or error code
- */
-int wma_bus_suspend(struct wow_enable_params wow_params)
-{
-	return __wma_bus_suspend(QDF_SYSTEM_SUSPEND, wow_params);
-}
-
-/**
  * __wma_bus_resume() - bus resume for wma
  *
  * does the part of the bus resume common to bus and system suspend
@@ -5607,19 +4900,7 @@
  */
 static int __wma_bus_resume(WMA_HANDLE handle)
 {
-	bool wow_mode = wma_is_wow_mode_selected(handle);
-	tp_wma_handle wma = handle;
-	QDF_STATUS status;
-
-	WMA_LOGI("%s: wow mode %d", __func__, wow_mode);
-
-	wma->wow_initial_wake_up = false;
-
-	if (!wow_mode)
-		return qdf_status_to_os_return(wma_resume_target(handle));
-
-	status = wma_disable_wow_in_fw(handle);
-	return qdf_status_to_os_return(status);
+	return 0;
 }
 
 /**
@@ -5646,25 +4927,6 @@
 }
 
 /**
- * wma_bus_resume() - handles bus resume request from hdd
- * @handle: valid wma handle
- *
- * Calls the appropriate handler based on configuration
- *
- * Return: 0 for success or error code
- */
-int wma_bus_resume(void)
-{
-	WMA_HANDLE handle = cds_get_context(QDF_MODULE_ID_WMA);
-	if (NULL == handle) {
-		WMA_LOGE("%s: wma context is NULL", __func__);
-		return -EFAULT;
-	}
-
-	return __wma_bus_resume(handle);
-}
-
-/**
  * wma_suspend_target_timeout() - Handles the target suspend timeout
  * @is_self_recovery_enabled: Is self recovery enabled or not
  *
@@ -5684,192 +4946,6 @@
 		QDF_BUG(0);
 }
 
-/**
- * wma_suspend_target() - suspend target
- * @handle: wma handle
- * @disable_target_intr: disable target interrupt
- *
- * Return: QDF_STATUS_SUCCESS for success or error code
- */
-QDF_STATUS wma_suspend_target(WMA_HANDLE handle, int disable_target_intr)
-{
-	tp_wma_handle wma_handle = (tp_wma_handle) handle;
-	QDF_STATUS status;
-	struct suspend_params param = {0};
-
-	tpAniSirGlobal pmac = cds_get_context(QDF_MODULE_ID_PE);
-
-	if (!wma_handle || !wma_handle->wmi_handle) {
-		WMA_LOGE("WMA is closed. can not issue suspend cmd");
-		return QDF_STATUS_E_INVAL;
-	}
-
-	if (NULL == pmac) {
-		WMA_LOGE("%s: Unable to get PE context", __func__);
-		return QDF_STATUS_E_INVAL;
-	}
-
-	qdf_event_reset(&wma_handle->target_suspend);
-	param.disable_target_intr = disable_target_intr;
-	status = wmi_unified_suspend_send(wma_handle->wmi_handle,
-				&param,
-				WMA_WILDCARD_PDEV_ID);
-	if (QDF_IS_STATUS_ERROR(status))
-		return status;
-
-	wmi_set_target_suspend(wma_handle->wmi_handle, true);
-
-	if (qdf_wait_single_event(&wma_handle->target_suspend,
-				  WMA_TGT_SUSPEND_COMPLETE_TIMEOUT)
-	    != QDF_STATUS_SUCCESS) {
-		WMA_LOGE("Failed to get ACK from firmware for pdev suspend");
-		wmi_set_target_suspend(wma_handle->wmi_handle, false);
-		wma_suspend_target_timeout(pmac->sme.enableSelfRecovery);
-		return QDF_STATUS_E_FAULT;
-	}
-
-	return QDF_STATUS_SUCCESS;
-}
-
-/**
- * wma_target_suspend_acknowledge() - update target susspend status
- * @context: HTC_INIT_INFO->context
- * @wow_nack: true when wow is rejected
- *
- * Return: none
- */
-void wma_target_suspend_acknowledge(void *context, bool wow_nack)
-{
-	tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA);
-
-	if (NULL == wma) {
-		WMA_LOGE("%s: wma is NULL", __func__);
-		return;
-	}
-
-	wma->wow_nack = wow_nack;
-	qdf_event_set(&wma->target_suspend);
-	if (wow_nack && !wmi_get_runtime_pm_inprogress(wma->wmi_handle)) {
-		cds_host_diag_log_work(&wma->wow_wake_lock,
-				       WMA_WAKE_LOCK_TIMEOUT,
-				       WIFI_POWER_EVENT_WAKELOCK_WOW);
-		qdf_wake_lock_timeout_acquire(&wma->wow_wake_lock,
-					      WMA_WAKE_LOCK_TIMEOUT);
-	}
-}
-
-/**
- * wma_handle_initial_wake_up() - handle inital wake up
- *
- * Return: none
- */
-void wma_handle_initial_wake_up(void)
-{
-	tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA);
-
-	if (NULL == wma) {
-		WMA_LOGE("%s: wma is NULL", __func__);
-		return;
-	}
-
-	wma->wow_initial_wake_up = true;
-}
-
-/**
- * wma_is_target_wake_up_received() - check for initial wake up
- *
- * Check if target initial wake up is received and fail PM suspend gracefully
- *
- * Return: -EAGAIN if initial wake up is received else 0
- */
-int wma_is_target_wake_up_received(void)
-{
-	tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA);
-
-	if (NULL == wma) {
-		WMA_LOGE("%s: wma is NULL", __func__);
-		return -EAGAIN;
-	}
-
-	if (wma->wow_initial_wake_up) {
-		WMA_LOGE("Target initial wake up received try again");
-		return -EAGAIN;
-	}
-
-	return 0;
-}
-
-/**
- * wma_clear_target_wake_up() - clear initial wake up
- *
- * Clear target initial wake up reason
- *
- * Return: 0 for success and negative error code for failure
- */
-int wma_clear_target_wake_up(void)
-{
-	tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA);
-
-	if (NULL == wma) {
-		WMA_LOGE("%s: wma is NULL", __func__);
-		return -EFAULT;
-	}
-
-	wma->wow_initial_wake_up = false;
-
-	return 0;
-}
-
-/**
- * wma_resume_target() - resume target
- * @handle: wma handle
- *
- * Return: QDF_STATUS_SUCCESS for success or error code
- */
-QDF_STATUS wma_resume_target(WMA_HANDLE handle)
-{
-	tp_wma_handle wma = (tp_wma_handle) handle;
-	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
-	tpAniSirGlobal pMac = cds_get_context(QDF_MODULE_ID_PE);
-	if (NULL == pMac) {
-		WMA_LOGE("%s: Unable to get PE context", __func__);
-		return QDF_STATUS_E_INVAL;
-	}
-
-	qdf_event_reset(&wma->wma_resume_event);
-	qdf_status = wmi_unified_resume_send(wma->wmi_handle,
-					WMA_WILDCARD_PDEV_ID);
-	if (QDF_IS_STATUS_ERROR(qdf_status))
-		WMA_LOGE("Failed to send WMI_PDEV_RESUME_CMDID command");
-
-	qdf_status = qdf_wait_single_event(&(wma->wma_resume_event),
-			WMA_RESUME_TIMEOUT);
-	if (QDF_STATUS_SUCCESS != qdf_status) {
-		WMA_LOGP("%s: Timeout waiting for resume event from FW",
-			__func__);
-		WMA_LOGP("%s: Pending commands %d credits %d", __func__,
-			wmi_get_pending_cmds(wma->wmi_handle),
-			wmi_get_host_credits(wma->wmi_handle));
-		if (!cds_is_driver_recovering()) {
-			if (pMac->sme.enableSelfRecovery) {
-				cds_trigger_recovery(false);
-			} else {
-				QDF_BUG(0);
-			}
-		} else {
-			WMA_LOGE("%s: SSR in progress, ignore resume timeout",
-				__func__);
-		}
-	} else {
-		WMA_LOGD("Host wakeup received");
-	}
-
-	if (QDF_STATUS_SUCCESS == qdf_status)
-		wmi_set_target_suspend(wma->wmi_handle, false);
-
-	return qdf_status;
-}
-
 #ifdef FEATURE_WLAN_TDLS
 /**
  * wma_tdls_event_handler() - handle TDLS event
diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c
index fd7e39a..0224fb7 100644
--- a/core/wma/src/wma_main.c
+++ b/core/wma/src/wma_main.c
@@ -1720,6 +1720,7 @@
 
 	qdf_event_set(&wma_handle->wma_resume_event);
 	wma_cleanup_vdev_resp_queue(wma_handle);
+	pmo_ucfg_psoc_wakeup_host_event_received(wma_handle->psoc);
 }
 
 struct wma_version_info g_wmi_version_info;
@@ -6575,10 +6576,6 @@
 		wma_resume_req(wma_handle, QDF_RUNTIME_SUSPEND);
 		break;
 
-	case WMA_WLAN_SUSPEND_IND:
-		wma_update_conn_state(wma_handle, msg->bodyval);
-		wma_suspend_req(wma_handle, QDF_SYSTEM_SUSPEND);
-		break;
 	case WMA_8023_MULTICAST_LIST_REQ:
 		wma_process_mcbc_set_filter_req(wma_handle,
 				(tpSirRcvFltMcAddrList) msg->bodyptr);
@@ -6717,10 +6714,6 @@
 				(tSirModemPowerStateInd *) msg->bodyptr);
 		qdf_mem_free(msg->bodyptr);
 		break;
-	case WMA_WLAN_RESUME_REQ:
-		wma_resume_req(wma_handle, QDF_SYSTEM_SUSPEND);
-		break;
-
 #ifdef WLAN_FEATURE_STATS_EXT
 	case WMA_STATS_EXT_REQUEST:
 		wma_stats_ext_req(wma_handle,