qcacmn: Add support to retrieve SAR power limits
Recently change "qcacmn: Add SAR power limit configuration" (Change-Id: I0a214a2af780e9dd8c381c4e9eaa7d8cab6ef853) added the ability to dynamically configure Specific Absorption Rate (SAR) power limits. Now add the ability to retrieve the current active power limits. Change-Id: I7a6071dee71300daa3a217780ff3523604a11795 CRs-Fixed: 2161451
This commit is contained in:
@@ -6629,13 +6629,6 @@ QDF_STATUS wmi_unified_send_multiple_vdev_restart_req_cmd(void *wmi_hdl,
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
/**
|
||||
* wmi_unified_send_sar_limit_cmd() - send sar limit cmd to fw
|
||||
* @wmi_hdl: wmi handle
|
||||
* @params: sar limit command params
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
|
||||
*/
|
||||
QDF_STATUS wmi_unified_send_sar_limit_cmd(void *wmi_hdl,
|
||||
struct sar_limit_cmd_params *params)
|
||||
{
|
||||
@@ -6648,6 +6641,31 @@ QDF_STATUS wmi_unified_send_sar_limit_cmd(void *wmi_hdl,
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
QDF_STATUS wmi_unified_get_sar_limit_cmd(void *wmi_hdl)
|
||||
{
|
||||
wmi_unified_t wmi_handle = wmi_hdl;
|
||||
|
||||
if (wmi_handle->ops->get_sar_limit_cmd)
|
||||
return wmi_handle->ops->get_sar_limit_cmd(wmi_handle);
|
||||
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
QDF_STATUS wmi_unified_extract_sar_limit_event(void *wmi_hdl,
|
||||
uint8_t *evt_buf,
|
||||
struct sar_limit_event *event)
|
||||
{
|
||||
wmi_unified_t wmi_handle = wmi_hdl;
|
||||
|
||||
if (wmi_handle->ops->extract_sar_limit_event)
|
||||
return wmi_handle->ops->extract_sar_limit_event(wmi_handle,
|
||||
evt_buf,
|
||||
event);
|
||||
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
#ifdef WLAN_FEATURE_DISA
|
||||
QDF_STATUS wmi_unified_encrypt_decrypt_send_cmd(void *wmi_hdl,
|
||||
struct disa_encrypt_decrypt_req_params *params)
|
||||
|
@@ -5263,6 +5263,95 @@ end:
|
||||
return qdf_status;
|
||||
}
|
||||
|
||||
static QDF_STATUS get_sar_limit_cmd_tlv(wmi_unified_t wmi_handle)
|
||||
{
|
||||
wmi_sar_get_limits_cmd_fixed_param *cmd;
|
||||
wmi_buf_t wmi_buf;
|
||||
uint32_t len;
|
||||
QDF_STATUS status;
|
||||
|
||||
WMI_LOGD(FL("Enter"));
|
||||
|
||||
len = sizeof(*cmd);
|
||||
wmi_buf = wmi_buf_alloc(wmi_handle, len);
|
||||
if (!wmi_buf) {
|
||||
WMI_LOGP(FL("failed to allocate memory for msg"));
|
||||
return QDF_STATUS_E_NOMEM;
|
||||
}
|
||||
|
||||
cmd = (wmi_sar_get_limits_cmd_fixed_param *)wmi_buf_data(wmi_buf);
|
||||
|
||||
WMITLV_SET_HDR(&cmd->tlv_header,
|
||||
WMITLV_TAG_STRUC_wmi_sar_get_limits_cmd_fixed_param,
|
||||
WMITLV_GET_STRUCT_TLVLEN
|
||||
(wmi_sar_get_limits_cmd_fixed_param));
|
||||
|
||||
cmd->reserved = 0;
|
||||
|
||||
status = wmi_unified_cmd_send(wmi_handle, wmi_buf, len,
|
||||
WMI_SAR_GET_LIMITS_CMDID);
|
||||
if (QDF_IS_STATUS_ERROR(status)) {
|
||||
WMI_LOGE(FL("Failed to send get SAR limit cmd: %d"), status);
|
||||
wmi_buf_free(wmi_buf);
|
||||
}
|
||||
|
||||
WMI_LOGD(FL("Exit"));
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static QDF_STATUS extract_sar_limit_event_tlv(wmi_unified_t wmi_handle,
|
||||
uint8_t *evt_buf,
|
||||
struct sar_limit_event *event)
|
||||
{
|
||||
wmi_sar_get_limits_event_fixed_param *fixed_param;
|
||||
WMI_SAR_GET_LIMITS_EVENTID_param_tlvs *param_buf;
|
||||
wmi_sar_get_limit_event_row *row_in;
|
||||
struct sar_limit_event_row *row_out;
|
||||
uint32_t row;
|
||||
|
||||
if (!evt_buf) {
|
||||
WMI_LOGE(FL("input event is NULL"));
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
if (!event) {
|
||||
WMI_LOGE(FL("output event is NULL"));
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
param_buf = (WMI_SAR_GET_LIMITS_EVENTID_param_tlvs *)evt_buf;
|
||||
|
||||
fixed_param = param_buf->fixed_param;
|
||||
if (!fixed_param) {
|
||||
WMI_LOGE(FL("Invalid fixed param"));
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
event->sar_enable = fixed_param->sar_enable;
|
||||
event->num_limit_rows = fixed_param->num_limit_rows;
|
||||
|
||||
if (event->num_limit_rows > MAX_SAR_LIMIT_ROWS_SUPPORTED) {
|
||||
QDF_ASSERT(0);
|
||||
WMI_LOGE(FL("Num rows %d exceeds max of %d"),
|
||||
event->num_limit_rows,
|
||||
MAX_SAR_LIMIT_ROWS_SUPPORTED);
|
||||
event->num_limit_rows = MAX_SAR_LIMIT_ROWS_SUPPORTED;
|
||||
}
|
||||
|
||||
row_in = param_buf->sar_get_limits;
|
||||
row_out = &event->sar_limit_row[0];
|
||||
for (row = 0; row < event->num_limit_rows; row++) {
|
||||
row_out->band_id = row_in->band_id;
|
||||
row_out->chain_id = row_in->chain_id;
|
||||
row_out->mod_id = row_in->mod_id;
|
||||
row_out->limit_value = row_in->limit_value;
|
||||
row_out++;
|
||||
row_in++;
|
||||
}
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef WLAN_FEATURE_DISA
|
||||
/**
|
||||
* send_encrypt_decrypt_send_cmd() - send encrypt/decrypt cmd to fw
|
||||
@@ -21581,6 +21670,8 @@ struct wmi_ops tlv_ops = {
|
||||
extract_encrypt_decrypt_resp_event_tlv,
|
||||
#endif
|
||||
.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,
|
||||
.send_power_dbg_cmd = send_power_dbg_cmd_tlv,
|
||||
.send_multiple_vdev_restart_req_cmd =
|
||||
send_multiple_vdev_restart_req_cmd_tlv,
|
||||
@@ -21953,6 +22044,7 @@ static void populate_tlv_events_id(uint32_t *event_ids)
|
||||
event_ids[wmi_sap_obss_detection_report_event_id] =
|
||||
WMI_SAP_OBSS_DETECTION_REPORT_EVENTID;
|
||||
event_ids[wmi_host_swfda_event_id] = WMI_HOST_SWFDA_EVENTID;
|
||||
event_ids[wmi_sar_get_limits_event_id] = WMI_SAR_GET_LIMITS_EVENTID;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_MCL
|
||||
|
Reference in New Issue
Block a user