From e6d4b284990b490ed91027799bbf5493c05cbf2e Mon Sep 17 00:00:00 2001 From: Anurag Chouhan Date: Fri, 22 Jul 2016 20:19:54 +0530 Subject: [PATCH] qcacmn: Add fwtest interface Add wmi fw test interface to support generic fw test command. Change-Id: Ic2dc113e3a698555c0fdcbafb30df154f6deb97d CRs-Fixed: 1045265 --- wmi/inc/wmi_unified_api.h | 3 +++ wmi/inc/wmi_unified_priv.h | 5 ++++- wmi/src/wmi_unified_api.c | 22 +++++++++++++++++++ wmi/src/wmi_unified_tlv.c | 43 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 72 insertions(+), 1 deletion(-) diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index 5ef8b5a7325c..7082ed1cdeec 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -1258,4 +1258,7 @@ QDF_STATUS wmi_unified_send_power_dbg_cmd(void *wmi_hdl, QDF_STATUS wmi_unified_send_adapt_dwelltime_params_cmd(void *wmi_hdl, struct wmi_adaptive_dwelltime_params * wmi_param); +QDF_STATUS wmi_unified_fw_test_cmd(void *wmi_hdl, + struct set_fwtest_params *wmi_fwtest); + #endif /* _WMI_UNIFIED_API_H_ */ diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index d8b19b715cc3..b9f1c8785abb 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -676,7 +676,7 @@ QDF_STATUS (*send_process_roam_synch_complete_cmd)(wmi_unified_t wmi_handle, uint8_t vdev_id); QDF_STATUS (*send_unit_test_cmd)(wmi_unified_t wmi_handle, - struct wmi_unit_test_cmd *wmi_utest); + struct wmi_unit_test_cmd *wmi_utest); QDF_STATUS (*send_roam_invoke_cmd)(wmi_unified_t wmi_handle, struct wmi_roam_invoke_cmd *roaminvoke, @@ -1124,6 +1124,9 @@ QDF_STATUS (*send_power_dbg_cmd)(wmi_unified_t wmi_handle, QDF_STATUS (*send_adapt_dwelltime_params_cmd)(wmi_unified_t wmi_handle, struct wmi_adaptive_dwelltime_params *dwelltime_params); + +QDF_STATUS (*send_fw_test_cmd)(wmi_unified_t wmi_handle, + struct set_fwtest_params *wmi_fwtest); }; struct target_abi_version { diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index 3fd8618808df..fb3da5de26f0 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -3233,6 +3233,28 @@ QDF_STATUS wmi_unified_roam_synch_complete_cmd(void *wmi_hdl, return QDF_STATUS_E_FAILURE; } +/** + * wmi_unified_fw_test_cmd() - send fw test command to fw. + * @wmi_hdl: wmi handle + * @wmi_fwtest: fw test command + * + * This function sends fw test command to fw. + * + * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure + */ +QDF_STATUS wmi_unified_fw_test_cmd(void *wmi_hdl, + struct set_fwtest_params *wmi_fwtest) +{ + wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl; + + if (wmi_handle->ops->send_fw_test_cmd) + return wmi_handle->ops->send_fw_test_cmd(wmi_handle, + wmi_fwtest); + + return QDF_STATUS_E_FAILURE; + +} + /** * wmi_unified_unit_test_cmd() - send unit test command to fw. * @wmi_hdl: wmi handle diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index a81d462398cc..03fe000bf98b 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -10104,6 +10104,48 @@ QDF_STATUS send_process_roam_synch_complete_cmd_tlv(wmi_unified_t wmi_handle, return QDF_STATUS_SUCCESS; } +/** + * send_fw_test_cmd_tlv() - send fw test command to fw. + * @wmi_handle: wmi handle + * @wmi_fwtest: fw test command + * + * This function sends fw test command to fw. + * + * Return: CDF STATUS + */ +QDF_STATUS send_fw_test_cmd_tlv(wmi_unified_t wmi_handle, + struct set_fwtest_params *wmi_fwtest) +{ + wmi_fwtest_set_param_cmd_fixed_param *cmd; + wmi_buf_t wmi_buf; + uint16_t len; + + len = sizeof(*cmd); + + wmi_buf = wmi_buf_alloc(wmi_handle, len); + if (!wmi_buf) { + WMI_LOGE("%s: wmai_buf_alloc failed", __func__); + return QDF_STATUS_E_NOMEM; + } + + cmd = (wmi_fwtest_set_param_cmd_fixed_param *) wmi_buf_data(wmi_buf); + WMITLV_SET_HDR(&cmd->tlv_header, + WMITLV_TAG_STRUC_wmi_fwtest_set_param_cmd_fixed_param, + WMITLV_GET_STRUCT_TLVLEN( + wmi_fwtest_set_param_cmd_fixed_param)); + cmd->param_id = wmi_fwtest->arg; + cmd->param_value = wmi_fwtest->value; + + if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, + WMI_FWTEST_CMDID)) { + WMI_LOGP("%s: failed to send fw test command", __func__); + qdf_nbuf_free(wmi_buf); + return QDF_STATUS_E_FAILURE; + } + + return QDF_STATUS_SUCCESS; +} + /** * send_unit_test_cmd_tlv() - send unit test command to fw. * @wmi_handle: wmi handle @@ -12095,6 +12137,7 @@ struct wmi_ops tlv_ops = { .extract_profile_data = extract_profile_data_tlv, .extract_chan_info_event = extract_chan_info_event_tlv, .extract_channel_hopping_event = extract_channel_hopping_event_tlv, + .send_fw_test_cmd = send_fw_test_cmd_tlv, }; #ifdef WMI_TLV_AND_NON_TLV_SUPPORT