summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKabilan Kannan <kabilank@codeaurora.org>2018-03-19 12:07:17 -0700
committernshrivas <nshrivas@codeaurora.org>2018-04-11 10:31:31 -0700
commitf2c9da5bc4a3ea4f8e5905be600ccbbb6d595186 (patch)
tree393831ad56a60098966bff8ff1b83a91eca8ce09
parent2e33c518aabcd791ee07820b4e8f5c6f079d8fbe (diff)
qcacld-3.0: Add SAR V2 support
Add changes to support SAR V2 power limits. Change-Id: I35f8a194ac9c53c8fd564bd301398b78fa995bed CRs-Fixed: 2217067
-rw-r--r--core/hdd/src/wlan_hdd_cfg80211.c13
-rw-r--r--core/wma/inc/wma.h2
-rw-r--r--core/wma/inc/wma_internal.h15
-rw-r--r--core/wma/src/wma_features.c14
-rw-r--r--core/wma/src/wma_main.c22
-rw-r--r--uapi/linux/qca_vendor.h20
6 files changed, 83 insertions, 3 deletions
diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c
index b4b96209afcc..66a8ddc64add 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.c
+++ b/core/hdd/src/wlan_hdd_cfg80211.c
@@ -9879,6 +9879,9 @@ 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;
}
@@ -9954,6 +9957,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;
}
}
@@ -9987,6 +9992,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
@@ -10335,8 +10341,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;
}
diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h
index 9c7256b39eb6..3083c1ebc967 100644
--- a/core/wma/inc/wma.h
+++ b/core/wma/inc/wma.h
@@ -1359,6 +1359,7 @@ struct hw_mode_idx_to_mac_cap_idx {
* @each_phy_cap_per_hwmode: PHY's caps for each hw mode
* @num_phy_for_hal_reg_cap: number of phy for hal reg cap
* @hw_mode_to_mac_cap_map: map between hw_mode to capabilities
+ * @sar_capability: supported SAR versions
*/
struct extended_caps {
WMI_SOC_MAC_PHY_HW_MODE_CAPS num_hw_modes;
@@ -1367,6 +1368,7 @@ struct extended_caps {
WMI_SOC_HAL_REG_CAPABILITIES num_phy_for_hal_reg_cap;
WMI_HAL_REG_CAPABILITIES_EXT *each_phy_hal_reg_cap;
struct hw_mode_idx_to_mac_cap_idx *hw_mode_to_mac_cap_map;
+ WMI_SAR_CAPABILITIES sar_capability;
};
/**
diff --git a/core/wma/inc/wma_internal.h b/core/wma/inc/wma_internal.h
index c8b5731a29fd..e27245a1e4cc 100644
--- a/core/wma/inc/wma_internal.h
+++ b/core/wma/inc/wma_internal.h
@@ -131,6 +131,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
@@ -1235,6 +1240,16 @@ QDF_STATUS wma_set_led_flashing(tp_wma_handle wma_handle,
tSirLedFlashingReq *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
int wma_channel_avoid_evt_handler(void *handle, uint8_t *event,
uint32_t len);
diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c
index 97a6fae28e33..84feff42bf35 100644
--- a/core/wma/src/wma_features.c
+++ b/core/wma/src/wma_features.c
@@ -8178,6 +8178,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_channel_avoid_evt_handler() - process channel to avoid event from FW.
diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c
index dae373290122..75622e8bb6a8 100644
--- a/core/wma/src/wma_main.c
+++ b/core/wma/src/wma_main.c
@@ -3538,6 +3538,18 @@ QDF_STATUS wma_start(void *cds_ctx)
goto end;
}
#endif /* FEATURE_WLAN_CH_AVOID */
+ WMA_LOGD("Registering SAR2 response handler");
+
+ status = wmi_unified_register_event_handler(wma_handle->wmi_handle,
+ WMI_SAR2_RESULT_EVENTID,
+ 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(wma_handle->wmi_handle,
@@ -5990,6 +6002,16 @@ static void wma_populate_soc_caps(t_wma_handle *wma_handle,
wma_cleanup_dbs_phy_caps(wma_handle);
return;
}
+
+ qdf_mem_copy(&phy_caps->sar_capability,
+ param_buf->sar_caps,
+ sizeof(WMI_SAR_CAPABILITIES));
+ if (phy_caps->sar_capability.active_version > SAR_VERSION_2) {
+ WMA_LOGE("%s: incorrect SAR version", __func__);
+ wma_cleanup_dbs_phy_caps(wma_handle);
+ return;
+ }
+
phy_caps->each_phy_hal_reg_cap =
qdf_mem_malloc(phy_caps->num_phy_for_hal_reg_cap.num_phy *
sizeof(WMI_HAL_REG_CAPABILITIES_EXT));
diff --git a/uapi/linux/qca_vendor.h b/uapi/linux/qca_vendor.h
index a46a520fec50..b0ad890328dd 100644
--- a/uapi/linux/qca_vendor.h
+++ b/uapi/linux/qca_vendor.h
@@ -4685,6 +4685,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
@@ -4700,6 +4702,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,
};
/**
@@ -4747,6 +4750,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
@@ -4769,8 +4777,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.
@@ -4784,6 +4799,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 =