diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index a1e65edca3..568cfac76f 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -3958,6 +3958,21 @@ QDF_STATUS wmi_extract_spectral_scaling_params_service_ready_ext( uint8_t *evt_buf, uint8_t idx, struct wlan_psoc_host_spectral_scaling_params *param); +#ifdef WLAN_RCC_ENHANCED_AOA_SUPPORT +/** + * wmi_extract_aoa_caps_service_ready_ext2: Extract AoA capabilities received + * through extended service ready event + * @wmi_handle: WMI handle + * @evt_buf: Event buffer + * @aoa_cap: Pointer to aoa cap + * + * Return: QDF status of operation + */ +QDF_STATUS wmi_extract_aoa_caps_service_ready_ext2( + wmi_unified_t wmi_handle, uint8_t *evt_buf, + struct wlan_psoc_host_rcc_enh_aoa_caps_ext2 *aoa_cap); +#endif /* WLAN_RCC_ENHANCED_AOA_SUPPORT */ + /** * wmi_extract_pdev_utf_event() - * extract UTF data from pdev utf event diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index c3f11284b0..1fe61eae0a 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -3361,6 +3361,11 @@ QDF_STATUS (*extract_aux_dev_cap_service_ready_ext2)( uint8_t *evt_buf, uint8_t idx, struct wlan_psoc_host_aux_dev_caps *param); +#ifdef WLAN_RCC_ENHANCED_AOA_SUPPORT +QDF_STATUS (*extract_aoa_caps_service_ready_ext2) + (struct wmi_unified *wmi_handle, uint8_t *buf, + struct wlan_psoc_host_rcc_enh_aoa_caps_ext2 *aoa_cap); +#endif /* WLAN_RCC_ENHANCED_AOA_SUPPORT */ }; /* Forward declaration for psoc*/ diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index 87a95dde45..1aa6a14aa7 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -2884,6 +2884,19 @@ QDF_STATUS wmi_extract_spectral_scaling_params_service_ready_ext( return QDF_STATUS_E_FAILURE; } +#ifdef WLAN_RCC_ENHANCED_AOA_SUPPORT +QDF_STATUS wmi_extract_aoa_caps_service_ready_ext2( + wmi_unified_t wmi_handle, uint8_t *evt_buf, + struct wlan_psoc_host_rcc_enh_aoa_caps_ext2 *aoa_cap) +{ + if (wmi_handle->ops->extract_aoa_caps_service_ready_ext2) + return wmi_handle->ops->extract_aoa_caps_service_ready_ext2 + (wmi_handle, evt_buf, aoa_cap); + + return QDF_STATUS_E_FAILURE; +} +#endif /* WLAN_RCC_ENHANCED_AOA_SUPPORT */ + QDF_STATUS wmi_extract_pdev_utf_event(wmi_unified_t wmi_handle, uint8_t *evt_buf, struct wmi_host_pdev_utf_event *param) diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 4a4fed5fb7..e803de72c7 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -5663,6 +5663,99 @@ extract_csa_ie_received_ev_params_tlv(wmi_unified_t wmi_handle, return QDF_STATUS_SUCCESS; } +#ifdef WLAN_RCC_ENHANCED_AOA_SUPPORT +static void +populate_per_band_aoa_caps(struct wlan_psoc_host_rcc_enh_aoa_caps_ext2 *aoa_cap, + wmi_enhanced_aoa_per_band_caps_param per_band_cap) +{ + uint8_t tbl_idx; + uint16_t *gain_array = NULL; + + if (per_band_cap.band_info == WMI_AOA_2G) + gain_array = aoa_cap->max_agc_gain_per_tbl_2g; + else if (per_band_cap.band_info == WMI_AOA_5G) + gain_array = aoa_cap->max_agc_gain_per_tbl_5g; + else if (per_band_cap.band_info == WMI_AOA_6G) + gain_array = aoa_cap->max_agc_gain_per_tbl_6g; + + if (!gain_array) { + wmi_debug("unhandled AOA BAND TYPE!! fix it"); + return; + } + + for (tbl_idx = 0; tbl_idx < aoa_cap->max_agc_gain_tbls; tbl_idx++) + WMI_AOA_MAX_AGC_GAIN_GET(per_band_cap.max_agc_gain, + tbl_idx, + gain_array[tbl_idx]); +} + +static void +populate_aoa_caps(struct wmi_unified *wmi_handle, + struct wlan_psoc_host_rcc_enh_aoa_caps_ext2 *aoa_cap, + wmi_enhanced_aoa_caps_param *aoa_caps_param) +{ + uint8_t tbl_idx; + + aoa_cap->max_agc_gain_tbls = aoa_caps_param->max_agc_gain_tbls; + if (aoa_cap->max_agc_gain_tbls > PSOC_MAX_NUM_AGC_GAIN_TBLS) { + wmi_err("Num gain table > PSOC_MAX_NUM_AGC_GAIN_TBLS cap"); + aoa_cap->max_agc_gain_tbls = PSOC_MAX_NUM_AGC_GAIN_TBLS; + } + + if (aoa_cap->max_agc_gain_tbls > WMI_AGC_MAX_GAIN_TABLE_IDX) { + wmi_err("num gain table > WMI_AGC_MAX_GAIN_TABLE_IDX cap"); + aoa_cap->max_agc_gain_tbls = WMI_AGC_MAX_GAIN_TABLE_IDX; + } + + for (tbl_idx = 0; tbl_idx < aoa_cap->max_agc_gain_tbls; tbl_idx++) { + WMI_AOA_MAX_BDF_ENTRIES_GET + (aoa_caps_param->max_bdf_gain_entries, + tbl_idx, aoa_cap->max_bdf_entries_per_tbl[tbl_idx]); + } +} + +/** + * extract_aoa_caps_tlv() - extract aoa cap tlv + * @wmi_handle: wmi handle + * @event: pointer to event buffer + * @aoa_cap: pointer to structure where capability needs to extracted + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +static QDF_STATUS +extract_aoa_caps_tlv(struct wmi_unified *wmi_handle, uint8_t *event, + struct wlan_psoc_host_rcc_enh_aoa_caps_ext2 *aoa_cap) +{ + int8_t band; + + WMI_SERVICE_READY_EXT2_EVENTID_param_tlvs *param_buf; + + param_buf = (WMI_SERVICE_READY_EXT2_EVENTID_param_tlvs *)event; + if (!param_buf) { + wmi_err("NULL param buf"); + return QDF_STATUS_E_INVAL; + } + + if (!param_buf->aoa_caps_param) { + wmi_debug("NULL aoa_caps_param"); + return QDF_STATUS_SUCCESS; + } + + if (!param_buf->num_aoa_per_band_caps_param || + !param_buf->aoa_per_band_caps_param) { + wmi_debug("No aoa_per_band_caps_param"); + return QDF_STATUS_SUCCESS; + } + populate_aoa_caps(wmi_handle, aoa_cap, param_buf->aoa_caps_param); + + for (band = 0; band < param_buf->num_aoa_per_band_caps_param; band++) + populate_per_band_aoa_caps + (aoa_cap, param_buf->aoa_per_band_caps_param[band]); + + return QDF_STATUS_SUCCESS; +} +#endif /* WLAN_RCC_ENHANCED_AOA_SUPPORT */ + /** * send_probe_rsp_tmpl_send_cmd_tlv() - send probe response template to fw * @wmi_handle: wmi handle @@ -21520,6 +21613,10 @@ struct wmi_ops tlv_ops = { .extract_csa_ie_received_ev_params = extract_csa_ie_received_ev_params_tlv, .extract_rf_path_resp = extract_rf_path_resp_tlv, +#ifdef WLAN_RCC_ENHANCED_AOA_SUPPORT + .extract_aoa_caps_service_ready_ext2 = + extract_aoa_caps_tlv, +#endif /* WLAN_RCC_ENHANCED_AOA_SUPPORT */ }; #ifdef WLAN_FEATURE_11BE_MLO