From e80cea9353ad4c74e0557fca4d59de1f921c7bea Mon Sep 17 00:00:00 2001 From: Srinivas Girigowda Date: Mon, 23 Nov 2015 11:33:57 -0800 Subject: [PATCH] qcacld-3.0: Add support for wakeable NLO_SCAN_COMPLETE_EVENT This is a qcacld-2.0 to qcacld-3.0 propagation. With RunTime PM feature enabled, after receiving the PNO matched event RunTime PM puts the host back in WoW suspend after 500ms (default). Since WMI_NLO_SCAN_COMPLETE_EVENTID is not a wakeable event, this event does not wakeup the host hence PNO scan not completed and PNO is broken. Fix this by making NLO_SCAN_COMPLETE_EVENT a wakeable event. Host driver configures this WoW event only after PNO match is received. Change-Id: I81cccc86942fc75bc63235038c50ba6edb0fee8b CRs-Fixed: 884211 --- core/wma/src/wma_features.c | 32 ++++++++++++++++++++++++++++++++ core/wma/src/wma_scan_roam.c | 3 +-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c index 5c8fc2fc81d7..68ab3d774e6a 100644 --- a/core/wma/src/wma_features.c +++ b/core/wma/src/wma_features.c @@ -102,6 +102,10 @@ static const uint8_t arp_mask[] = {0xff, 0xff}; static const uint8_t ns_ptrn[] = {0x86, 0xDD}; static const uint8_t discvr_ptrn[] = {0xe0, 0x00, 0x00, 0xf8}; static const uint8_t discvr_mask[] = {0xf0, 0x00, 0x00, 0xf8}; +static CDF_STATUS wma_add_wow_wakeup_event(tp_wma_handle wma, + uint32_t vdev_id, + uint32_t bitmap, + bool enable); #ifdef FEATURE_WLAN_AUTO_SHUTDOWN /** @@ -2464,6 +2468,8 @@ static const u8 *wma_wow_wake_reason_str(A_INT32 wake_reason) #endif case WOW_REASON_RSSI_BREACH_EVENT: return "WOW_REASON_RSSI_BREACH_EVENT"; + case WOW_REASON_NLO_SCAN_COMPLETE: + return "WOW_REASON_NLO_SCAN_COMPLETE"; } return "unknown"; } @@ -2674,11 +2680,37 @@ int wma_wow_wakeup_host_event(void *handle, uint8_t *event, wma_wow_wake_up_stats(wma, NULL, 0, WOW_REASON_NLOD); node = &wma->interfaces[wake_info->vdev_id]; if (node) { + CDF_STATUS ret = CDF_STATUS_SUCCESS; WMA_LOGD("NLO match happened"); node->nlo_match_evt_received = true; cdf_wake_lock_timeout_acquire(&wma->pno_wake_lock, WMA_PNO_MATCH_WAKE_LOCK_TIMEOUT, WIFI_POWER_EVENT_WAKELOCK_PNO); + /* Configure pno scan complete wakeup */ + ret = wma_add_wow_wakeup_event(wma, wake_info->vdev_id, + (1 << WOW_NLO_SCAN_COMPLETE_EVENT), + true); + if (ret != CDF_STATUS_SUCCESS) + WMA_LOGE("Failed to configure pno scan complete wakeup"); + else + WMA_LOGD("PNO scan complete wakeup is enabled in fw"); + } + break; + + case WOW_REASON_NLO_SCAN_COMPLETE: + { + WMI_NLO_SCAN_COMPLETE_EVENTID_param_tlvs param; + + WMA_LOGD("Host woken up due to pno scan complete reason"); + + /* First 4-bytes of wow_packet_buffer is the length */ + if (param_buf->wow_packet_buffer) { + param.fixed_param = (wmi_nlo_event *) + (param_buf->wow_packet_buffer + 4); + wma_nlo_scan_cmp_evt_handler(handle, + (u_int8_t *)¶m, sizeof(param)); + } else + WMA_LOGD("No wow_packet_buffer present"); } break; #endif /* FEATURE_WLAN_SCAN_PNO */ diff --git a/core/wma/src/wma_scan_roam.c b/core/wma/src/wma_scan_roam.c index e7f83f1cb6e0..46f474eee369 100644 --- a/core/wma/src/wma_scan_roam.c +++ b/core/wma/src/wma_scan_roam.c @@ -4193,8 +4193,7 @@ int wma_nlo_scan_cmp_evt_handler(void *handle, uint8_t *event, /* Handle scan completion event only after NLO match event. */ if (!node || !node->nlo_match_evt_received) { - - WMA_LOGD("NLO match not recieved skipping PNO complete ind for vdev %d", + WMA_LOGD("NLO match not received skip PNO complete ind for vdev %d", nlo_event->vdev_id); goto skip_pno_cmp_ind; }