qcacld-3.0: Add SAR V2 support

Add changes to support SAR V2 power limits.

Change-Id: I35f8a194ac9c53c8fd564bd301398b78fa995bed
CRs-Fixed: 2217067
This commit is contained in:
Kabilan Kannan
2018-04-13 18:04:58 -07:00
committed by nshrivas
parent a0e8242bc6
commit caa8550b4c
4 changed files with 53 additions and 1 deletions

View File

@@ -11481,6 +11481,10 @@ static int wlan_hdd_cfg80211_sar_convert_limit_set(u32 nl80211_value,
case QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_USER:
*wmi_value = WMI_SAR_FEATURE_ON_USER_DEFINED;
break;
case QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_V2_0:
*wmi_value = WMI_SAR_FEATURE_ON_SAR_V2_0;
break;
default:
ret = -1;
}
@@ -11556,6 +11560,8 @@ static u32 hdd_sar_wmi_to_nl_enable(uint32_t wmi_value)
return QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_BDF4;
case WMI_SAR_FEATURE_ON_USER_DEFINED:
return QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_USER;
case WMI_SAR_FEATURE_ON_SAR_V2_0:
return QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_V2_0;
}
}
@@ -11589,6 +11595,7 @@ sar_limits_policy[QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_MAX + 1] = {
[QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_CHAIN] = {.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_MODULATION] = {.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT] = {.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT_INDEX] = {.type = NLA_U32},
};
#define WLAN_WAIT_TIME_SAR 5000
@@ -11942,8 +11949,13 @@ static int __wlan_hdd_set_sar_power_limits(struct wiphy *wiphy,
sar_limit_cmd.sar_limit_row_list[i].limit_value =
nla_get_u32(sar_spec[
QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT]);
} else if (sar_spec[
QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT_INDEX]) {
sar_limit_cmd.sar_limit_row_list[i].limit_value =
nla_get_u32(sar_spec[
QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT_INDEX]);
} else {
hdd_err("SAR Spec does not have power limit value");
hdd_err("SAR Spec does not have power limit or index value");
goto fail;
}

View File

@@ -112,6 +112,11 @@
#define MAX_NUM_HW_MODE 0xff
#define MAX_NUM_PHY 0xff
enum sar_version {
SAR_VERSION_1,
SAR_VERSION_2
};
/**
* struct index_data_rate_type - non vht data rate type
* @mcs_index: mcs rate index
@@ -1061,6 +1066,16 @@ QDF_STATUS wma_set_led_flashing(tp_wma_handle wma_handle,
struct flashing_req_params *flashing);
#endif
/**
* wma_sar_rsp_evt_handler() - process sar response event from FW.
* @handle: wma handle
* @event: event buffer
* @len: buffer length
*
* Return: 0 for success or error code
*/
int wma_sar_rsp_evt_handler(void *handle, uint8_t *event, uint32_t len);
#ifdef FEATURE_WLAN_CH_AVOID
QDF_STATUS wma_process_ch_avoid_update_req(tp_wma_handle wma_handle,
tSirChAvoidUpdateReq *

View File

@@ -4047,6 +4047,20 @@ QDF_STATUS wma_set_led_flashing(tp_wma_handle wma_handle,
}
#endif /* WLAN_FEATURE_GPIO_LED_FLASHING */
int wma_sar_rsp_evt_handler(void *handle, uint8_t *event, uint32_t len)
{
QDF_STATUS status;
status = wmi_unified_extract_sar2_result_event(handle,
event, len);
if (QDF_IS_STATUS_ERROR(status)) {
WMA_LOGE(FL("Event extract failure: %d"), status);
return -EINVAL;
}
return 0;
}
#ifdef FEATURE_WLAN_CH_AVOID
/**
* wma_process_ch_avoid_update_req() - handles channel avoid update request

View File

@@ -4131,6 +4131,17 @@ QDF_STATUS wma_start(void)
WMA_RX_TASKLET_CTX);
#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
WMA_LOGD("Registering SAR2 response handler");
status = wmi_unified_register_event_handler(wma_handle->wmi_handle,
wmi_wlan_sar2_result_event_id,
wma_sar_rsp_evt_handler,
WMA_RX_SERIALIZER_CTX);
if (status) {
WMA_LOGE("Failed to register sar response event cb");
qdf_status = QDF_STATUS_E_FAILURE;
goto end;
}
#ifdef FEATURE_WLAN_AUTO_SHUTDOWN
WMA_LOGD("Registering auto shutdown handler");
status = wmi_unified_register_event_handler(wmi_handle,