hc
2023-11-06 e3e12f52b214121840b44c91de5b3e5af5d3eb84
kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dbus.c
....@@ -2452,14 +2452,19 @@
24522452 dhd_pub_t *dhd = (dhd_pub_t *)handle;
24532453 unsigned long flags;
24542454 wifi_adapter_info_t *adapter;
2455
+ int wowl_dngldown = 0;
24552456
24562457 if (dhd == NULL) {
24572458 DBUSERR(("%s: dhd is NULL\n", __FUNCTION__));
24582459 return;
24592460 }
24602461 adapter = (wifi_adapter_info_t *)dhd->adapter;
2462
+#ifdef WL_EXT_WOWL
2463
+ wowl_dngldown = dhd_conf_wowl_dngldown(dhd);
2464
+#endif
24612465
2462
- if (dhd->busstate == DHD_BUS_SUSPEND && state == DBUS_STATE_DOWN) {
2466
+ if ((dhd->busstate == DHD_BUS_SUSPEND && state == DBUS_STATE_DOWN) ||
2467
+ (dhd->hostsleep && wowl_dngldown)) {
24632468 DBUSERR(("%s: switch state %d to %d\n", __FUNCTION__, state, DBUS_STATE_SLEEP));
24642469 state = DBUS_STATE_SLEEP;
24652470 }
....@@ -3059,6 +3064,7 @@
30593064 }
30603065
30613066 DBUSTRACE(("%s: Exit\n", __FUNCTION__));
3067
+ wifi_clr_adapter_status(adapter, WIFI_STATUS_BUS_DISCONNECTED);
30623068 if (net_attached) {
30633069 wifi_set_adapter_status(adapter, WIFI_STATUS_NET_ATTACHED);
30643070 wake_up_interruptible(&adapter->status_event);
....@@ -3112,6 +3118,7 @@
31123118 dhd_dbus_advertise_bus_remove(bus->dhd);
31133119 dbus_detach(pub->bus);
31143120 pub->bus = NULL;
3121
+ wifi_set_adapter_status(adapter, WIFI_STATUS_BUS_DISCONNECTED);
31153122 wake_up_interruptible(&adapter->status_event);
31163123 } else {
31173124 osh = pub->osh;
....@@ -3133,6 +3140,24 @@
31333140 DBUSTRACE(("%s: Exit\n", __FUNCTION__));
31343141 }
31353142
3143
+int
3144
+dhd_bus_sleep(dhd_pub_t *dhdp, bool sleep, uint32 *intstatus)
3145
+{
3146
+ wifi_adapter_info_t *adapter = (wifi_adapter_info_t *)dhdp->adapter;
3147
+ s32 timeout = -1;
3148
+ int err = 0;
3149
+
3150
+ timeout = wait_event_interruptible_timeout(adapter->status_event,
3151
+ wifi_get_adapter_status(adapter, WIFI_STATUS_BUS_DISCONNECTED),
3152
+ msecs_to_jiffies(12000));
3153
+ if (timeout <= 0) {
3154
+ err = -1;
3155
+ DBUSERR(("%s: bus disconnected timeout\n", __FUNCTION__));
3156
+ }
3157
+
3158
+ return err;
3159
+}
3160
+
31363161 #ifdef LINUX_EXTERNAL_MODULE_DBUS
31373162
31383163 static int __init