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 0c45b0848f
commit 762ad5db89
8 changed files with 196 additions and 2 deletions

View File

@@ -4883,6 +4883,8 @@ enum qca_wlan_vendor_tdls_trigger_mode {
* limit feature.
* @QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_USER: Select the SAR power
* limits configured by %QCA_NL80211_VENDOR_SUBCMD_SET_SAR.
* @QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_V2_0: Select the SAR power
* limits version 2.0 configured by %QCA_NL80211_VENDOR_SUBCMD_SET_SAR.
*
* This enumerates the valid set of values that may be supplied for
* attribute %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT in an instance of
@@ -4898,6 +4900,7 @@ enum qca_vendor_attr_sar_limits_selections {
QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_BDF4 = 4,
QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_NONE = 5,
QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_USER = 6,
QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_V2_0 = 7,
};
/**
@@ -4945,6 +4948,11 @@ enum qca_vendor_attr_sar_limits_spec_modulations {
* %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_MODULATION and always
* contains as a payload the attribute
* %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT.
* %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT_INDEX.
* Either %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT or
* %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT_INDEX is
* needed based upon the value of
* %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SAR_ENABLE.
*
* @QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_BAND: Optional (u32) value to
* indicate for which band this specification applies. Valid
@@ -4967,8 +4975,15 @@ enum qca_vendor_attr_sar_limits_spec_modulations {
* modulation schemes.
*
* @QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT: Required (u32)
* value to specify the actual power limit value in steps of 0.5
* dbm.
* value to specify the actual power limit value in units of 0.5
* dBm (i.e., a value of 11 represents 5.5 dBm).
* This is required, when %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT is
* %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_USER.
*
* @QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT_INDEX: Required (u32)
* value to indicate SAR V2 indices (0 - 11) to select SAR V2 profiles.
* This is required, when %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT is
* %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_V2_0.
*
* These attributes are used with %QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS
* and %QCA_NL80211_VENDOR_SUBCMD_GET_SAR_LIMITS.
@@ -4982,6 +4997,7 @@ enum qca_vendor_attr_sar_limits {
QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_CHAIN = 5,
QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_MODULATION = 6,
QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT = 7,
QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT_INDEX = 8,
QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_AFTER_LAST,
QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_MAX =

View File

@@ -280,6 +280,7 @@ struct wlan_psoc_host_chainmask_table {
* @num_chainmask_tables: Number of chain mask tables.
* @num_dbr_ring_caps: Number of direct buf rx ring capabilities
* @chainmask_table: Available chain mask tables.
* @sar_version: SAR version info
*/
struct wlan_psoc_host_service_ext_param {
uint32_t default_conc_scan_config_bits;
@@ -295,6 +296,7 @@ struct wlan_psoc_host_service_ext_param {
uint32_t num_dbr_ring_caps;
struct wlan_psoc_host_chainmask_table
chainmask_table[PSOC_MAX_CHAINMASK_TABLES];
uint32_t sar_version;
};
#endif /* _SERVICE_READY_PARAM_H_*/

View File

@@ -197,6 +197,20 @@ static int get_hw_mode(void *handle, uint8_t *evt, uint8_t hw_idx,
return 0;
}
static int get_sar_version(void *handle, uint8_t *evt,
struct wlan_psoc_host_service_ext_param *ext_param)
{
QDF_STATUS status;
status = wmi_extract_sar_cap_service_ready_ext(handle, evt, ext_param);
if (QDF_IS_STATUS_ERROR(status)) {
target_if_err("failed to parse sar capability");
return qdf_status_to_os_return(status);
}
return 0;
}
int init_deinit_populate_hw_mode_capability(void *wmi_handle,
uint8_t *event, struct target_psoc_info *tgt_hdl)
{
@@ -239,6 +253,9 @@ int init_deinit_populate_hw_mode_capability(void *wmi_handle,
target_if_info("num radios is %d\n", info->num_radios);
}
}
status = get_sar_version(wmi_handle, event, &info->service_ext_param);
target_if_info("sar version %d",
info->service_ext_param.sar_version);
return_exit:
return qdf_status_to_os_return(status);

View File

@@ -1786,6 +1786,31 @@ QDF_STATUS wmi_unified_extract_sar_limit_event(void *wmi_hdl,
uint8_t *evt_buf,
struct sar_limit_event *event);
/**
* wmi_unified_extract_sar2_result_event() - extract SAR limits from FW event
* @handle: wmi handle
* @event: event buffer received from firmware
* @len: length of the event buffer
*
* Return: QDF_STATUS_SUCCESS for success or error code
*/
QDF_STATUS wmi_unified_extract_sar2_result_event(void *handle,
uint8_t *event, uint32_t len);
/**
* wmi_extract_sar_cap_service_ready_ext() - extract SAR cap from
* FW service ready event
* @wmi_hdl: wmi handle
* @evt_buf: event buffer received from firmware
* @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);
QDF_STATUS wmi_unified_send_adapt_dwelltime_params_cmd(void *wmi_hdl,
struct wmi_adaptive_dwelltime_params *
wmi_param);

View File

@@ -5534,6 +5534,7 @@ typedef enum {
#ifdef OL_ATH_SMART_LOGGING
wmi_debug_fatal_condition_eventid,
#endif /* OL_ATH_SMART_LOGGING */
wmi_wlan_sar2_result_event_id,
wmi_events_max,
} wmi_conv_event_id;

View File

@@ -1410,6 +1410,10 @@ QDF_STATUS (*extract_sar_limit_event)(wmi_unified_t wmi_handle,
uint8_t *evt_buf,
struct sar_limit_event *event);
QDF_STATUS (*extract_sar2_result_event)(void *handle,
uint8_t *event,
uint32_t len);
QDF_STATUS (*send_peer_rx_reorder_queue_setup_cmd)(wmi_unified_t wmi_handle,
struct rx_reorder_queue_setup_params *param);
@@ -1442,6 +1446,11 @@ QDF_STATUS (*extract_dbr_ring_cap_service_ready_ext)(
uint8_t *evt_buf, uint8_t idx,
struct wlan_psoc_host_dbr_ring_caps *param);
QDF_STATUS (*extract_sar_cap_service_ready_ext)(
wmi_unified_t wmi_handle,
uint8_t *evt_buf,
struct wlan_psoc_host_service_ext_param *ext_param);
QDF_STATUS (*extract_dbr_buf_release_fixed)(
wmi_unified_t wmi_handle,
uint8_t *evt_buf,

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;
}
/**