From cebcc29de592381701059a92f4d1e33efe677352 Mon Sep 17 00:00:00 2001 From: Krunal Soni Date: Wed, 14 Jun 2017 19:59:20 -0700 Subject: [PATCH] qcacld-3.0: Keep wake lock while HW mode is getting changed Host should keep the wake lock from the time it sends set hw mode request to FW till it receives the set hw mode response. This will avoid any fatal crash condition. Change-Id: I6ab1020811100be1adbb70b90a06285dc8bed88c CRs-Fixed: 2060010 --- core/wma/inc/wma.h | 1 + core/wma/src/wma_main.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h index 239d7f31d7c3..8245ff198600 100644 --- a/core/wma/inc/wma.h +++ b/core/wma/inc/wma.h @@ -266,6 +266,7 @@ enum ds_mode { #define WMA_DELETE_PEER_RSP 0x05 #define WMA_VDEV_START_REQUEST_TIMEOUT (6000) /* 6 seconds */ #define WMA_VDEV_STOP_REQUEST_TIMEOUT (6000) /* 6 seconds */ +#define WMA_VDEV_HW_MODE_REQUEST_TIMEOUT (5000) /* 5 seconds */ /* * The firmware value has been changed recently to 0x127 diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 1ba7f83cd27c..4a1360974230 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -2758,7 +2758,7 @@ static int wma_pdev_set_hw_mode_resp_evt_handler(void *handle, */ return QDF_STATUS_E_NULL_VALUE; } - + wma_release_wmi_resp_wakelock(wma); hw_mode_resp = qdf_mem_malloc(sizeof(*hw_mode_resp)); if (!hw_mode_resp) { WMA_LOGE("%s: Memory allocation failed", __func__); @@ -7233,9 +7233,13 @@ QDF_STATUS wma_send_pdev_set_hw_mode_cmd(tp_wma_handle wma_handle, goto fail; } + wma_acquire_wmi_resp_wakelock(wma_handle, + WMA_VDEV_HW_MODE_REQUEST_TIMEOUT); if (wmi_unified_soc_set_hw_mode_cmd(wma_handle->wmi_handle, - msg->hw_mode_index)) + msg->hw_mode_index)) { + wma_release_wmi_resp_wakelock(wma_handle); goto fail; + } return QDF_STATUS_SUCCESS; fail: