[WCNCR00152333] wowlan: fix USB resume wow check condition

[Description]
1. fix "mtk_usb_resume"
when USB resume, execute wow resume only if connection to ap
if not connected, skip wow resume flow
2. fix typo "WowTriigerLevel"

Feature: wowlan
Change-Id: I1247607f64e3533a16a2e1ca0a330b0d75568996
Signed-off-by: Bennett Ou <bennett.ou@mediatek.com>
CR-Id: WCNCR00152333
diff --git a/common/wlan_lib.c b/common/wlan_lib.c
index 39e8f94..786bf72 100644
--- a/common/wlan_lib.c
+++ b/common/wlan_lib.c
@@ -6802,7 +6802,7 @@
 	prAdapter->rWowCtrl.astWakeHif[0].ucWakeupHif =
 		(UINT_8) wlanCfgGetUint32(prAdapter, "WowHif", ENUM_HIF_TYPE_GPIO);
 	prAdapter->rWowCtrl.astWakeHif[0].ucGpioPin = (UINT_8) wlanCfgGetUint32(prAdapter, "WowGpioPin", 0xFF);
-	prAdapter->rWowCtrl.astWakeHif[0].ucTriggerLvl = (UINT_8) wlanCfgGetUint32(prAdapter, "WowTriigerLevel", 3);
+	prAdapter->rWowCtrl.astWakeHif[0].ucTriggerLvl = (UINT_8) wlanCfgGetUint32(prAdapter, "WowTriggerLevel", 3);
 	prAdapter->rWowCtrl.astWakeHif[0].u4GpioInterval = wlanCfgGetUint32(prAdapter, "GpioInterval", 0);
 #endif
 
diff --git a/include/nic_cmd_event.h b/include/nic_cmd_event.h
index 6c6f08c..7963f14 100644
--- a/include/nic_cmd_event.h
+++ b/include/nic_cmd_event.h
@@ -700,7 +700,8 @@
 	UINT_16		u2FilterFlag; /* ARP/MC/DropExceptMagic/SendMagicToHost */
 	UINT_8		ucScenarioID; /* WOW/WOBLE/Proximity */
 	UINT_8		ucBlockCount;
-	UINT_8		aucReserved1[2];
+	UINT_8		ucDbdcBand;
+	UINT_8		aucReserved1[1];
 	CMD_WAKE_HIF_T astWakeHif[2];
 	WOW_PORT_T	stWowPort;
 	UINT_8		aucReserved2[32];
diff --git a/os/linux/gl_kal.c b/os/linux/gl_kal.c
index c1ffa38..0af3b11 100644
--- a/os/linux/gl_kal.c
+++ b/os/linux/gl_kal.c
@@ -4988,12 +4988,16 @@
 	prGlueInfo->prAdapter->fgSetPfCapabilityDone = FALSE;
 	prGlueInfo->prAdapter->fgSetWowDone = FALSE;
 
-	DBGLOG(PF, INFO, "PF, pAd ucBssIndex=%d, ucOwnMacIndex=%d\n",
-		prGlueInfo->prAdapter->prAisBssInfo->ucBssIndex, prGlueInfo->prAdapter->prAisBssInfo->ucOwnMacIndex);
+	DBGLOG(PF, INFO, "PF, pAd AIS ucBssIndex=%d, ucOwnMacIndex=%d, band=%d\n",
+		prGlueInfo->prAdapter->prAisBssInfo->ucBssIndex, prGlueInfo->prAdapter->prAisBssInfo->ucOwnMacIndex,
+		prGlueInfo->prAdapter->prAisBssInfo->eDBDCBand);
 
 	DBGLOG(PF, INFO, "profile wow=%d, GpioInterval=%d\n",
 		prGlueInfo->prAdapter->rWifiVar.ucWow, prGlueInfo->prAdapter->rWowCtrl.astWakeHif[0].u4GpioInterval);
 
+	/* add band info */
+	rCmdWowlanParam.ucDbdcBand = (UINT_8)prGlueInfo->prAdapter->prAisBssInfo->eDBDCBand;
+
 	rCmdPacket_Filter_Cap.packet_cap_type |= PACKETF_CAP_TYPE_MAGIC;
 	/* 20160627 Bennett: if receive BMC magic, PF search by bssid index, which is different with OM index */
 	/* After discussion, enable all bssid bits */
diff --git a/os/linux/hif/usb/usb.c b/os/linux/hif/usb/usb.c
index 3ee4403..c94d2ef 100644
--- a/os/linux/hif/usb/usb.c
+++ b/os/linux/hif/usb/usb.c
@@ -300,9 +300,12 @@
 	prGlueInfo->rHifInfo.state = USB_STATE_LINK_UP;
 	halEnableInterrupt(prGlueInfo->prAdapter);
 
-	if (prGlueInfo->prAdapter->rWifiVar.ucWow) {
-		DBGLOG(HAL, EVENT, "leave WOW flow\n");
-		kalWowProcess(prGlueInfo, FALSE);
+	/* 1) wifi cfg "Wow" is true, 2) wow is enable 3) WIfI connected => execute WOW leave */
+	if (prGlueInfo->prAdapter->rWifiVar.ucWow && prGlueInfo->prAdapter->rWowCtrl.fgWowEnable) {
+		if (kalGetMediaStateIndicated(prGlueInfo) == PARAM_MEDIA_STATE_CONNECTED) {
+			DBGLOG(HAL, EVENT, "leave WOW flow\n");
+			kalWowProcess(prGlueInfo, FALSE);
+		}
 	}
 
 	DBGLOG(HAL, STATE, "mtk_usb_resume() done!\n");