qcacmn: Add SAR V2 support

Add changes to support SAR V2 power limits

Change-Id: Ife7af8db51a45660bc27d1e5b857e38f4dd40935
CRs-Fixed: 2217069
This commit is contained in:
Kabilan Kannan
2018-06-21 16:55:47 -07:00
committed by nshrivas
parent b522ac9226
commit 0d0f935b47
2 changed files with 124 additions and 0 deletions

View File

@@ -6551,6 +6551,18 @@ QDF_STATUS wmi_unified_extract_sar_limit_event(void *wmi_hdl,
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_extract_sar2_result_event(void *handle,
uint8_t *event, uint32_t len)
{
wmi_unified_t wmi_handle = handle;
if (wmi_handle->ops->extract_sar2_result_event)
return wmi_handle->ops->extract_sar2_result_event(wmi_handle,
event,
len);
return QDF_STATUS_E_FAILURE;
}
#ifdef WLAN_FEATURE_DISA
QDF_STATUS wmi_unified_encrypt_decrypt_send_cmd(void *wmi_hdl,
@@ -6641,6 +6653,30 @@ QDF_STATUS wmi_extract_service_ready_ext(void *wmi_hdl, uint8_t *evt_buf,
return QDF_STATUS_E_FAILURE;
}
/**
* wmi_extract_sar_cap_service_ready_ext() -
* extract sar cap from service ready event
* @wmi_handle: wmi handle
* @evt_buf: pointer to event buffer
* @ext_param: extended target info
*
* Return: QDF_STATUS_SUCCESS for success or error code
*/
QDF_STATUS wmi_extract_sar_cap_service_ready_ext(
void *wmi_hdl,
uint8_t *evt_buf,
struct wlan_psoc_host_service_ext_param *ext_param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->extract_sar_cap_service_ready_ext)
return wmi_handle->ops->extract_sar_cap_service_ready_ext(
wmi_handle,
evt_buf, ext_param);
return QDF_STATUS_E_FAILURE;
}
/**
* wmi_extract_hw_mode_cap_service_ready_ext() -
* extract HW mode cap from service ready event

View File

@@ -5668,6 +5668,62 @@ static QDF_STATUS get_sar_limit_cmd_tlv(wmi_unified_t wmi_handle)
return status;
}
/**
* wmi_sar2_result_string() - return string conversion of sar2 result
* @result: sar2 result value
*
* This utility function helps log string conversion of sar2 result.
*
* Return: string conversion of sar 2 result, if match found;
* "Unknown response" otherwise.
*/
static const char *wmi_sar2_result_string(uint32_t result)
{
switch (result) {
CASE_RETURN_STRING(WMI_SAR2_SUCCESS);
CASE_RETURN_STRING(WMI_SAR2_INVALID_ANTENNA_INDEX);
CASE_RETURN_STRING(WMI_SAR2_INVALID_TABLE_INDEX);
CASE_RETURN_STRING(WMI_SAR2_STATE_ERROR);
CASE_RETURN_STRING(WMI_SAR2_BDF_NO_TABLE);
default:
return "Unknown response";
}
}
/**
* extract_sar2_result_event_tlv() - process sar response event from FW.
* @handle: wma handle
* @event: event buffer
* @len: buffer length
*
* Return: 0 for success or error code
*/
static QDF_STATUS extract_sar2_result_event_tlv(void *handle,
uint8_t *event,
uint32_t len)
{
wmi_sar2_result_event_fixed_param *sar2_fixed_param;
WMI_SAR2_RESULT_EVENTID_param_tlvs *param_buf =
(WMI_SAR2_RESULT_EVENTID_param_tlvs *)event;
if (!param_buf) {
WMI_LOGI("Invalid sar2 result event buffer");
return QDF_STATUS_E_INVAL;
}
sar2_fixed_param = param_buf->fixed_param;
if (!sar2_fixed_param) {
WMI_LOGI("Invalid sar2 result event fixed param buffer");
return QDF_STATUS_E_INVAL;
}
WMI_LOGI("SAR2 result: %s",
wmi_sar2_result_string(sar2_fixed_param->result));
return QDF_STATUS_SUCCESS;
}
static QDF_STATUS extract_sar_limit_event_tlv(wmi_unified_t wmi_handle,
uint8_t *evt_buf,
struct sar_limit_event *event)
@@ -19225,6 +19281,34 @@ static QDF_STATUS extract_service_ready_ext_tlv(wmi_unified_t wmi_handle,
return QDF_STATUS_SUCCESS;
}
/**
* extract_sar_cap_service_ready_ext_tlv() -
* extract SAR cap from service ready event
* @wmi_handle: wmi handle
* @event: pointer to event buffer
* @ext_param: extended target info
*
* Return: QDF_STATUS_SUCCESS for success or error code
*/
static QDF_STATUS extract_sar_cap_service_ready_ext_tlv(
wmi_unified_t wmi_handle,
uint8_t *event,
struct wlan_psoc_host_service_ext_param *ext_param)
{
WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf;
WMI_SAR_CAPABILITIES *sar_caps;
param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *)event;
sar_caps = param_buf->sar_caps;
if (!sar_caps)
return QDF_STATUS_E_INVAL;
ext_param->sar_version = sar_caps->active_version;
return QDF_STATUS_SUCCESS;
}
/**
* extract_hw_mode_cap_service_ready_ext_tlv() -
* extract HW mode cap from service ready event
@@ -22068,6 +22152,7 @@ struct wmi_ops tlv_ops = {
.send_sar_limit_cmd = send_sar_limit_cmd_tlv,
.get_sar_limit_cmd = get_sar_limit_cmd_tlv,
.extract_sar_limit_event = extract_sar_limit_event_tlv,
.extract_sar2_result_event = extract_sar2_result_event_tlv,
.send_power_dbg_cmd = send_power_dbg_cmd_tlv,
.send_multiple_vdev_restart_req_cmd =
send_multiple_vdev_restart_req_cmd_tlv,
@@ -22080,6 +22165,8 @@ struct wmi_ops tlv_ops = {
extract_reg_cap_service_ready_ext_tlv,
.extract_dbr_ring_cap_service_ready_ext =
extract_dbr_ring_cap_service_ready_ext_tlv,
.extract_sar_cap_service_ready_ext =
extract_sar_cap_service_ready_ext_tlv,
.extract_dbr_buf_release_fixed = extract_dbr_buf_release_fixed_tlv,
.extract_dbr_buf_release_entry = extract_dbr_buf_release_entry_tlv,
.extract_dbr_buf_metadata = extract_dbr_buf_metadata_tlv,
@@ -22475,6 +22562,7 @@ static void populate_tlv_events_id(uint32_t *event_ids)
WMI_TWT_ENABLE_COMPLETE_EVENTID;
event_ids[wmi_apf_get_vdev_work_memory_resp_event_id] =
WMI_BPF_GET_VDEV_WORK_MEMORY_RESP_EVENTID;
event_ids[wmi_wlan_sar2_result_event_id] = WMI_SAR2_RESULT_EVENTID;
}
/**