wlan: P2P-GO in suspend mode doesn't go to IMPS state.

In this issue, GO after disconnection moves into suspended
state before it can change its interface to p2p device.
As a result in suspended state DUT couldn't move into IMPS.
As a part of fix, DUT will not enter into suspend state until
its interface has changed to p2p device.

Change-Id: Iede165c565941eb4b2f19803d1878255f8659c2d
CRs-Fixed: 696484
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 3e57614..8126551 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -9725,7 +9725,31 @@
     hddLog(LOGE, "%s: Invalid context", __func__);
     return VOS_STA;
 }
+v_BOOL_t
+wlan_hdd_is_GO_power_collapse_allowed (hdd_context_t* pHddCtx)
+{
+     hdd_adapter_t *pAdapter = NULL;
 
+     pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_GO);
+     if (pAdapter == NULL)
+     {
+         hddLog(VOS_TRACE_LEVEL_INFO,
+                FL("GO doesn't exist"));
+         return TRUE;
+     }
+     if (test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags))
+     {
+          hddLog(VOS_TRACE_LEVEL_INFO,
+                 FL("GO started"));
+          return TRUE;
+     }
+     else
+          /* wait till GO changes its interface to p2p device */
+          hddLog(VOS_TRACE_LEVEL_INFO,
+                 FL("Del_bss called, avoid apps suspend"));
+          return FALSE;
+
+}
 /* Decide whether to allow/not the apps power collapse. 
  * Allow apps power collapse if we are in connected state.
  * if not, allow only if we are in IMPS  */
@@ -9745,9 +9769,13 @@
 
     concurrent_state = hdd_get_concurrency_mode();
 
+    if ((concurrent_state == (VOS_STA | VOS_P2P_GO)) &&
+          !(wlan_hdd_is_GO_power_collapse_allowed(pHddCtx)))
+        return FALSE;
 #ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
+
     if(((concurrent_state == (VOS_STA | VOS_P2P_CLIENT)) || 
-        (concurrent_state == (VOS_STA | VOS_P2P_GO))) && 
+        (concurrent_state == (VOS_STA | VOS_P2P_GO)))&&
         (IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
         return TRUE;
 #endif