[WCNCR00170190] wow: Fix can't wakeup host via USB remote wakeup repeatly issue
[Description]
Fix can't wakeup host via USB remote wakeup repeatly issue
Without the device_init_wakeup() call, the host will disable the remote
wakeup function of the dongle via standard ClearFeature request after
first time resuming and never re-enable it again. Thus, we can only
wakeup host via USB in-band remote wakeup once.
With the device_init_wakeup() call, host will re-enable the remote
wakeup via standard SetFeature request just before entering suspend.
Thus, the USB remote wakeup function can work repeatly.
Change-Id: Id3593bd68e7d7780d39c64537acd1db03f991082
Signed-off-by: Awk Jiang <awk.jiang@mediatek.com>
CR-Id: WCNCR00170190
Feature: wow
Reviewed-on: http://gerrit.mediatek.inc:8080/1272990
CheckPatch: Check Patch <srv_checkpatch@mediatek.com>
Reviewed-by: George Kuo <george.kuo@mediatek.com>
Reviewed-by: Deren Wu <deren.wu@mediatek.com>
Build: srv_neptune_adm <srv_neptune_adm@mediatek.com>
diff --git a/common/wlan_lib.c b/common/wlan_lib.c
index 661a122..4f2e7d2 100644
--- a/common/wlan_lib.c
+++ b/common/wlan_lib.c
@@ -9846,4 +9846,3 @@
if (prGlueInfo->prAdapter->u4IsKeepFullPwrBitmap)
wlanKeepFullPwr(prGlueInfo->prAdapter, TRUE);
}
-
diff --git a/os/linux/gl_init.c b/os/linux/gl_init.c
index ac89773..bbc7c0f 100644
--- a/os/linux/gl_init.c
+++ b/os/linux/gl_init.c
@@ -1365,6 +1365,7 @@
P_GLUE_INFO_T prGlueInfo;
INT_32 i4DevIdx = -1;
P_NETDEV_PRIVATE_GLUE_INFO prNetDevPrivate = (P_NETDEV_PRIVATE_GLUE_INFO) NULL;
+ P_ADAPTER_T prAdapter = NULL;
ASSERT(prWdev);
@@ -1373,12 +1374,16 @@
break;
prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(prWdev->wiphy);
+ prAdapter = prGlueInfo->prAdapter;
i4DevIdx = wlanGetDevIdx(prWdev->netdev);
if (i4DevIdx < 0) {
DBGLOG(INIT, ERROR, "net_device number exceeds!\n");
break;
}
+ if (prAdapter && prAdapter->rWifiVar.ucWow)
+ kalInitDevWakeup(prGlueInfo->prAdapter, wiphy_dev(prWdev->wiphy));
+
if (register_netdev(prWdev->netdev) < 0) {
DBGLOG(INIT, ERROR, "Register net_device failed\n");
wlanClearDevIdx(prWdev->netdev);
diff --git a/os/linux/gl_kal.c b/os/linux/gl_kal.c
index fbf3e26..84b9cba 100644
--- a/os/linux/gl_kal.c
+++ b/os/linux/gl_kal.c
@@ -5288,3 +5288,15 @@
schedule_work(&prAdapter->prGlueInfo->rTxMsduFreeWork);
}
+
+VOID kalInitDevWakeup(P_ADAPTER_T prAdapter, struct device *prDev)
+{
+ /*
+ * The remote wakeup function will be disabled after first time resume,
+ * we need to call device_init_wakeup() to notify usbcore that we
+ * support wakeup function, so usbcore will re-enable our remote wakeup
+ * function before entering suspend.
+ */
+ if (prAdapter->rWifiVar.ucWow)
+ device_init_wakeup(prDev, TRUE);
+}
diff --git a/os/linux/include/gl_kal.h b/os/linux/include/gl_kal.h
index ae5b008..46b28ac 100644
--- a/os/linux/include/gl_kal.h
+++ b/os/linux/include/gl_kal.h
@@ -1263,4 +1263,7 @@
return div_u64(dividend, divisor);
}
+VOID kalInitDevWakeup(P_ADAPTER_T prAdapter, struct device *prDev);
+
+
#endif /* _GL_KAL_H */