Skip to content

Commit 4868c8a

Browse files
nxf58150nashif
authored andcommitted
drivers: wifi: nxp: Host sleep handshake enhancement
To reduce low power current value, added host sleep handshake enhancement. If CPU3 is wokenup by WLAN, do host sleep handshake with CPU1 as before. For other wakeup sources, skip host sleep handshake. Signed-off-by: Hui Bai <hui.bai@nxp.com>
1 parent bf86f1f commit 4868c8a

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

drivers/wifi/nxp/nxp_wifi_drv.c

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ extern const rtos_wpa_supp_dev_ops wpa_supp_ops;
7676
#if defined(CONFIG_PM_DEVICE) && defined(CONFIG_NXP_RW610)
7777
extern int is_hs_handshake_done;
7878
extern int wlan_host_sleep_state;
79+
extern bool skip_hs_handshake;
80+
extern void wlan_hs_hanshake_cfg(bool skip);
7981
#endif
8082

8183
static int nxp_wifi_recv(struct net_if *iface, struct net_pkt *pkt);
@@ -2102,16 +2104,33 @@ static int device_wlan_pm_action(const struct device *dev, enum pm_device_action
21022104
* User can use this time to issue other commands.
21032105
*/
21042106
if (is_hs_handshake_done == WLAN_HOSTSLEEP_SUCCESS) {
2105-
ret = wlan_hs_send_event(HOST_SLEEP_EXIT, NULL);
2106-
if (ret != 0) {
2107-
return -EFAULT;
2107+
/* If we are not woken up by WLAN, skip posting host sleep exit event.
2108+
* And skip host sleep handshake next time we are about to sleep.
2109+
*/
2110+
if (POWER_GetWakeupStatus(WL_MCI_WAKEUP0_IRQn)) {
2111+
ret = wlan_hs_send_event(HOST_SLEEP_EXIT, NULL);
2112+
if (ret != 0) {
2113+
return -EFAULT;
2114+
}
2115+
wlan_hs_hanshake_cfg(false);
2116+
} else {
2117+
wlan_hs_hanshake_cfg(true);
21082118
}
2119+
21092120
device_pm_dump_wakeup_source();
2110-
/* reset hs hanshake flag after waking up */
2111-
is_hs_handshake_done = 0;
21122121
if (wlan_host_sleep_state == HOST_SLEEP_ONESHOT) {
21132122
wlan_host_sleep_state = HOST_SLEEP_DISABLE;
2123+
wlan_hs_hanshake_cfg(false);
2124+
}
2125+
#ifndef CONFIG_BT
2126+
if (skip_hs_handshake == true &&
2127+
is_hs_handshake_done == WLAN_HOSTSLEEP_SUCCESS) {
2128+
ret = wlan_hs_send_event(HOST_SLEEP_HANDSHAKE_SKIP, NULL);
2129+
if (ret != 0) {
2130+
return -EFAULT;
2131+
}
21142132
}
2133+
#endif
21152134
}
21162135
break;
21172136
default:

0 commit comments

Comments
 (0)