am 46875614: Add wake_lock delay after start/stop commands

Merge commit '46875614b6c744a8054a045bc0d9dc271cb9f2ff' into eclair-plus-aosp

* commit '46875614b6c744a8054a045bc0d9dc271cb9f2ff':
  Add wake_lock delay after start/stop commands
diff --git a/wilink_6_1/platforms/os/common/inc/osApi.h b/wilink_6_1/platforms/os/common/inc/osApi.h
index 2c9de61..f8a9311 100644
--- a/wilink_6_1/platforms/os/common/inc/osApi.h
+++ b/wilink_6_1/platforms/os/common/inc/osApi.h
@@ -529,14 +529,15 @@
  */
 void os_protectUnlock (TI_HANDLE OsContext, TI_HANDLE ProtectContext);
 
+/* Wakelock functionality */
 int os_wake_lock (TI_HANDLE OsContext);
 int os_wake_unlock (TI_HANDLE OsContext);
 int os_wake_lock_timeout (TI_HANDLE OsContext);
+int os_wake_lock_timeout_enable (TI_HANDLE OsContext);
 
 #define os_profile(hos,fn,par)
 
 
-
 /****************************************************************************************
 						START OF GWSI DRIVER API				
 *****************************************************************************************/
diff --git a/wilink_6_1/platforms/os/linux/src/WlanDrvIf.c b/wilink_6_1/platforms/os/linux/src/WlanDrvIf.c
index afdd005..39f1b49 100644
--- a/wilink_6_1/platforms/os/linux/src/WlanDrvIf.c
+++ b/wilink_6_1/platforms/os/linux/src/WlanDrvIf.c
@@ -612,7 +612,7 @@
      *      and wait for action completion (all init process).
      */
     drvMain_InsertAction (drv->tCommon.hDrvMain, ACTION_TYPE_START);
-
+    os_wake_lock_timeout_enable(drv);
     return 0;
 }
 
@@ -672,6 +672,7 @@
      *      and wait for Stop process completion.
      */
     drvMain_InsertAction (drv->tCommon.hDrvMain, ACTION_TYPE_STOP);
+    os_wake_lock_timeout_enable(drv);
     return 0;
 }
 
diff --git a/wilink_6_1/platforms/os/linux/src/osapi.c b/wilink_6_1/platforms/os/linux/src/osapi.c
index 810c62a..4bdae8d 100644
--- a/wilink_6_1/platforms/os/linux/src/osapi.c
+++ b/wilink_6_1/platforms/os/linux/src/osapi.c
@@ -478,13 +478,9 @@
     * it responsibly of the Linux kernel to free the skb
     */
    {
-       unsigned long flags;
-
        CL_TRACE_START_L1();
 
-       spin_lock_irqsave(&drv->lock, flags);
-       drv->wl_packet = 1;
-       spin_unlock_irqrestore(&drv->lock, flags);
+       os_wake_lock_timeout_enable(drv);
 
        netif_rx_ni(skb);
 
@@ -622,6 +618,27 @@
 }
 
 /*-----------------------------------------------------------------------------
+Routine Name:  os_wake_lock_timeout_enable
+
+Routine Description: Called to set flag for suspend prevention for some time
+
+Arguments:     OsContext - handle to OS context
+
+Return Value:  packet counter
+-----------------------------------------------------------------------------*/
+int os_wake_lock_timeout_enable (TI_HANDLE OsContext)
+{
+	TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext;
+	unsigned long flags;
+	int ret;
+
+	spin_lock_irqsave(&drv->lock, flags);
+	ret = drv->wl_packet = 1;
+	spin_unlock_irqrestore(&drv->lock, flags);
+	return ret;
+}
+
+/*-----------------------------------------------------------------------------
 Routine Name:  os_wake_lock
 
 Routine Description: Called to prevent system from suspend