qcacld-3.0: Recover if fail to receive HTC ACK from FW for PDEV suspend

qcacld-2.0 to qcacld-3.0 propagation

If self-recovery is enabled in ini file, recover if host driver fails to
receive HTC ACK from FW for PDEV suspend, otherwise do VOS_BUG.

Change-Id: Ieddb22c5806067ec1a1166b60e1642e6cdf74a4c
CRs-fixed: 894187
diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c
index 065f2e3..adc553d 100644
--- a/core/wma/src/wma_features.c
+++ b/core/wma/src/wma_features.c
@@ -5873,11 +5873,22 @@
 	uint32_t len = sizeof(*cmd);
 	struct ol_softc *scn;
 	int ret;
+#ifdef CONFIG_CNSS
+	tpAniSirGlobal pmac = cds_get_context(CDF_MODULE_ID_PE);
+#endif
 
 	if (!wma_handle || !wma_handle->wmi_handle) {
 		WMA_LOGE("WMA is closed. can not issue suspend cmd");
 		return -EINVAL;
 	}
+
+#ifdef CONFIG_CNSS
+	if (NULL == pmac) {
+		WMA_LOGE("%s: Unable to get PE context", __func__);
+		return -EINVAL;
+	}
+#endif
+
 	/*
 	 * send the comand to Target to ignore the
 	 * PCIE reset so as to ensure that Host and target
@@ -5912,6 +5923,13 @@
 	    != CDF_STATUS_SUCCESS) {
 		WMA_LOGE("Failed to get ACK from firmware for pdev suspend");
 		wmi_set_target_suspend(wma_handle->wmi_handle, false);
+#ifdef CONFIG_CNSS
+		if (pmac->sme.enableSelfRecovery) {
+			cds_trigger_recovery();
+		} else {
+			CDF_BUG(0);
+		}
+#endif
 		return -EFAULT;
 	}