wlan: Add debug for Rx interrupt and host power state

In case of interrupts disabled in IMPS state, they should be
re-enabled when power state changes to full power. In some
stability issues Rx interrupt disabled in IMPS state still
remains in the same state.

Currently there is no debug information to understand about this
scenario. To address this add debug code for Rx interrupt and host
power state.

Change-Id: Ie40493356dea461a91a453d9123ce9da511c4864
CRs-Fixed: 1020656
diff --git a/CORE/DXE/src/wlan_qct_dxe.c b/CORE/DXE/src/wlan_qct_dxe.c
index 7a1487c..0de9402 100644
--- a/CORE/DXE/src/wlan_qct_dxe.c
+++ b/CORE/DXE/src/wlan_qct_dxe.c
@@ -2714,7 +2714,9 @@
       /* Interrupt will not enabled at here, it will be enabled at PS mode change */
       tempDxeCtrlBlk->rxIntDisabledByIMPS = eWLAN_PAL_TRUE;
       dxeEnvBlk.rxIntDisableReturn = VOS_RETURN_ADDRESS;
-
+      dxeEnvBlk.rxIntDisableFrame = __builtin_frame_address(0);
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+            "dxeRXEventHandler RX Int Disabled by IMPS");
       return;
    }
 
@@ -3150,6 +3152,9 @@
       /* Interrupt will not enabled at here, it will be enabled at PS mode change */
       tempDxeCtrlBlk->rxIntDisabledByIMPS = eWLAN_PAL_TRUE;
       dxeEnvBlk.rxIntDisableReturn = VOS_RETURN_ADDRESS;
+      dxeEnvBlk.rxIntDisableFrame = __builtin_frame_address(0);
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+            "dxeRXPacketAvailableEventHandler Int Disabled by IMPS");
    }
 }
 
@@ -5602,6 +5607,7 @@
    WLANDXE_PowerStateType   hostPowerState;
    wpt_msg                 *rxCompMsg;
    wpt_msg                 *txDescReSyncMsg;
+   int                      state;
 
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __func__);
@@ -5616,6 +5622,7 @@
    switch(powerState)
    {
       case WDTS_POWER_STATE_FULL:
+         dxeEnvBlk.dxe_prev_ps = pDxeCtrlBlk->hostPowerState;
          if(WLANDXE_POWER_STATE_IMPS == pDxeCtrlBlk->hostPowerState)
          {
             txDescReSyncMsg = (wpt_msg *)wpalMemoryAllocate(sizeof(wpt_msg));
@@ -5747,6 +5754,14 @@
       }
    }
 
+   if (WLANDXE_POWER_STATE_FULL == pDxeCtrlBlk->hostPowerState) {
+      state = wpal_get_int_state(DXE_INTERRUPT_RX_READY);
+      if (0 == state && eWLAN_PAL_TRUE == pDxeCtrlBlk->rxIntDisabledByIMPS) {
+          dxeEnvBlk.rx_imps_set_fp = 1;
+          WARN_ON(1);
+      }
+   }
+
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __func__);
 
diff --git a/CORE/DXE/src/wlan_qct_dxe_i.h b/CORE/DXE/src/wlan_qct_dxe_i.h
index 88678b6..9c2eb8f 100644
--- a/CORE/DXE/src/wlan_qct_dxe_i.h
+++ b/CORE/DXE/src/wlan_qct_dxe_i.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -732,9 +732,12 @@
 typedef struct
 {
    u64                             *rxIntDisableReturn;
+   u64                             *rxIntDisableFrame;
    wpt_uint8                       rxIntChanlSrc;
    wpt_uint8                       txCmpIntChanlSrc;
    wpt_uint8                       rx_low_resource_timer;
+   wpt_uint8                       dxe_prev_ps;
+   wpt_uint8                       rx_imps_set_fp;
 } WLANDXE_EnvInformation;
 
 typedef struct
diff --git a/CORE/WDI/WPAL/inc/wlan_qct_pal_device.h b/CORE/WDI/WPAL/inc/wlan_qct_pal_device.h
index 8cb3c32..bf13fe1 100644
--- a/CORE/WDI/WPAL/inc/wlan_qct_pal_device.h
+++ b/CORE/WDI/WPAL/inc/wlan_qct_pal_device.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013, 2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -306,4 +306,10 @@
 */
 void wpalInactivateRxInterrupt(void);
 
+
+int wpal_get_int_state
+(
+   wpt_uint32                          intType
+);
+
 #endif /* WLAN_QCT_PAL_DEVICE_H*/
diff --git a/CORE/WDI/WPAL/src/wlan_qct_pal_device.c b/CORE/WDI/WPAL/src/wlan_qct_pal_device.c
index 1c08371..3a43565 100644
--- a/CORE/WDI/WPAL/src/wlan_qct_pal_device.c
+++ b/CORE/WDI/WPAL/src/wlan_qct_pal_device.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -823,3 +823,28 @@
    return eWLAN_PAL_STATUS_SUCCESS;
 }
 
+/* Get Interrupt Status */
+int wpal_get_int_state
+(
+   wpt_uint32    intType
+)
+{
+   int ret;
+   ret = 0;
+
+   switch (intType)
+   {
+   case DXE_INTERRUPT_RX_READY:
+      if (gpEnv->rx_isr_enabled == 1)
+          ret = 1;
+      break;
+   case DXE_INTERRUPT_TX_COMPLE:
+      if (gpEnv->tx_isr_enabled == 1)
+          ret = 1;
+      break;
+   default:
+      break;
+   }
+
+   return ret;
+}