wlan: Add wake lock for find AP indication

It could be possible that host sleeps before it process find AP
indication and disconnect from current AP. It won't be able to
connect to new AP in this case.

Add wakelock to keep host awake for 1000ms once it gets find
AP indication.

CRs-Fixed: 2018351
Change-Id: I43cb297f9c3cb28b68e104e94a36407c895e153f
diff --git a/CORE/WDI/CP/src/wlan_qct_wdi.c b/CORE/WDI/CP/src/wlan_qct_wdi.c
index a153bb9..d8c2dd4 100644
--- a/CORE/WDI/CP/src/wlan_qct_wdi.c
+++ b/CORE/WDI/CP/src/wlan_qct_wdi.c
@@ -90,6 +90,7 @@
 
 #include "pttMsgApi.h"
 #include "vos_trace.h"
+#include "vos_diag_core_event.h"
 
 #include "vos_api.h"
 
@@ -2339,7 +2340,6 @@
       goto fail_wdts_open;
     }
   }
-
   /*The WDI is initialized - set state to init */
   gWDICb.uGlobalState = WDI_INIT_ST;
   gWDICb.roamDelayStatsEnabled = vos_get_roam_delay_stats_enabled();
@@ -2353,6 +2353,8 @@
 
   wdi_register_debug_callback();
 
+  vos_wake_lock_init(&gWDICb.find_ap_lock, "find_ap_lock");
+
   return WDI_STATUS_SUCCESS;
 
   /* ERROR handlers
@@ -2700,7 +2702,7 @@
                 "Failed to delete mutex %d", wptStatus);
      WDI_ASSERT(0);
   }
-
+  vos_wake_lock_destroy(&gWDICb.find_ap_lock);
   /*Clear control block.  note that this will clear the "magic"
     which will inhibit all asynchronous callbacks*/
   WDI_CleanCB(&gWDICb);
@@ -27843,6 +27845,7 @@
 #endif
 
 #ifdef WLAN_FEATURE_APFIND
+#define FIND_AP_WAKELOCK_TIMEOUT 1000
 /**
  @brief Process QRF Preferred Network Found Indication function
 
@@ -27874,7 +27877,9 @@
      WDI_ASSERT( 0 );
      return WDI_STATUS_E_FAILURE;
   }
-
+  vos_wake_lock_timeout_release(&pWDICtx->find_ap_lock,
+                                FIND_AP_WAKELOCK_TIMEOUT,
+                                WIFI_POWER_EVENT_WAKELOCK_FIND_AP_INDICATION);
   /*Fill in the indication parameters*/
   wdiInd.wdiIndicationType = WDI_AP_FOUND_IND;
   if ( pWDICtx->wdiLowLevelIndCB )