qcacmn: Add support to process Spectral capabilities event
WMI_SPECTRAL_CAPABILITIES_EVENTID event will be sent by the target SW to indicate the different capabilities of the Spectral HW. Add support to process this event and extract the capabilities. Change-Id: I03b3236b6def98d24e77b2a9ea51ee866e62e6fe CRs-Fixed: 3238450
This commit is contained in:

committed by
Madan Koyyalamudi

parent
11ae3a31b7
commit
3567bb3b57
@@ -7746,6 +7746,101 @@ release_pdev_ref:
|
||||
return qdf_status_to_os_return(status);
|
||||
}
|
||||
|
||||
/**
|
||||
* target_if_spectral_capabilities_event_handler() - Handler for the Spectral
|
||||
* Capabilities event
|
||||
* @scn: Pointer to scn object
|
||||
* @data_buf: Pointer to event buffer
|
||||
* @data_len: Length of event buffer
|
||||
*
|
||||
* Return: 0 for success, else failure
|
||||
*/
|
||||
static int
|
||||
target_if_spectral_capabilities_event_handler(ol_scn_t scn, uint8_t *data_buf,
|
||||
uint32_t data_len)
|
||||
{
|
||||
QDF_STATUS status;
|
||||
struct wlan_objmgr_psoc *psoc;
|
||||
struct wmi_unified *wmi_handle;
|
||||
struct spectral_capabilities_event_params event_params = {0};
|
||||
struct spectral_scan_bw_capabilities *bw_caps;
|
||||
struct spectral_fft_size_capabilities *fft_size_caps;
|
||||
|
||||
if (!scn) {
|
||||
spectral_err("scn handle is null");
|
||||
return qdf_status_to_os_return(QDF_STATUS_E_INVAL);
|
||||
}
|
||||
|
||||
if (!data_buf) {
|
||||
spectral_err("WMI event buffer null");
|
||||
return qdf_status_to_os_return(QDF_STATUS_E_INVAL);
|
||||
}
|
||||
|
||||
psoc = target_if_spectral_get_psoc_from_scn_handle(scn);
|
||||
if (!psoc) {
|
||||
spectral_err("psoc is null");
|
||||
return qdf_status_to_os_return(QDF_STATUS_E_FAILURE);
|
||||
}
|
||||
|
||||
wmi_handle = GET_WMI_HDL_FROM_PSOC(psoc);
|
||||
if (!wmi_handle) {
|
||||
spectral_err("WMI handle is null");
|
||||
return qdf_status_to_os_return(QDF_STATUS_E_FAILURE);
|
||||
}
|
||||
|
||||
status = target_if_wmi_extract_spectral_caps_fixed_param(
|
||||
psoc, data_buf, &event_params);
|
||||
if (QDF_IS_STATUS_ERROR(status)) {
|
||||
spectral_err("Failed to extract fixed parameters");
|
||||
return qdf_status_to_os_return(QDF_STATUS_E_FAILURE);
|
||||
}
|
||||
|
||||
/* There should be atleast one capability */
|
||||
qdf_assert(event_params.num_sscan_bw_caps > 0);
|
||||
qdf_assert(event_params.num_fft_size_caps > 0);
|
||||
|
||||
bw_caps = qdf_mem_malloc(
|
||||
sizeof(*bw_caps) * event_params.num_sscan_bw_caps);
|
||||
if (!bw_caps) {
|
||||
spectral_err("memory allocation failed");
|
||||
return qdf_status_to_os_return(QDF_STATUS_E_NOMEM);
|
||||
}
|
||||
|
||||
status = target_if_wmi_extract_spectral_scan_bw_caps(psoc, data_buf,
|
||||
bw_caps);
|
||||
if (QDF_IS_STATUS_ERROR(status)) {
|
||||
spectral_err("Failed to extract BW caps");
|
||||
status = QDF_STATUS_E_FAILURE;
|
||||
goto free_bw_caps;
|
||||
}
|
||||
|
||||
fft_size_caps = qdf_mem_malloc(
|
||||
sizeof(*fft_size_caps) * event_params.num_fft_size_caps);
|
||||
if (!fft_size_caps) {
|
||||
spectral_err("memory allocation failed");
|
||||
status = QDF_STATUS_E_NOMEM;
|
||||
goto free_bw_caps;
|
||||
}
|
||||
|
||||
status = target_if_wmi_extract_spectral_fft_size_caps(psoc, data_buf,
|
||||
fft_size_caps);
|
||||
if (QDF_IS_STATUS_ERROR(status)) {
|
||||
spectral_err("Failed to extract fft size caps");
|
||||
status = QDF_STATUS_E_FAILURE;
|
||||
goto free_fft_size_caps;
|
||||
}
|
||||
|
||||
status = QDF_STATUS_SUCCESS;
|
||||
|
||||
free_fft_size_caps:
|
||||
qdf_mem_free(fft_size_caps);
|
||||
|
||||
free_bw_caps:
|
||||
qdf_mem_free(bw_caps);
|
||||
|
||||
return qdf_status_to_os_return(status);
|
||||
}
|
||||
|
||||
static QDF_STATUS
|
||||
target_if_spectral_register_events(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
@@ -7765,6 +7860,16 @@ target_if_spectral_register_events(struct wlan_objmgr_psoc *psoc)
|
||||
if (ret)
|
||||
spectral_debug("event handler not supported, ret=%d", ret);
|
||||
|
||||
ret = target_if_spectral_wmi_unified_register_event_handler(
|
||||
psoc,
|
||||
wmi_spectral_capabilities_eventid,
|
||||
target_if_spectral_capabilities_event_handler,
|
||||
WMI_RX_UMAC_CTX);
|
||||
if (ret) {
|
||||
spectral_debug("event handler not supported, ret=%d", ret);
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -7778,6 +7883,9 @@ target_if_spectral_unregister_events(struct wlan_objmgr_psoc *psoc)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
target_if_spectral_wmi_unified_unregister_event_handler(
|
||||
psoc, wmi_spectral_capabilities_eventid);
|
||||
|
||||
ret = target_if_spectral_wmi_unified_unregister_event_handler(
|
||||
psoc, wmi_pdev_sscan_fw_param_eventid);
|
||||
|
||||
|
@@ -5075,6 +5075,7 @@ typedef enum {
|
||||
#ifdef WLAN_FEATURE_DBAM_CONFIG
|
||||
wmi_coex_dbam_complete_event_id,
|
||||
#endif
|
||||
wmi_spectral_capabilities_eventid,
|
||||
wmi_events_max,
|
||||
} wmi_conv_event_id;
|
||||
|
||||
|
@@ -7889,13 +7889,13 @@ extract_spectral_fft_size_caps_tlv(
|
||||
fft_size_caps[idx].sscan_bw = wmi_map_ch_width(
|
||||
param_buf->fft_size_caps[idx].sscan_bw);
|
||||
fft_size_caps[idx].supports_fft_sizes =
|
||||
param_buf->sscan_bw_caps[idx].supported_flags;
|
||||
param_buf->fft_size_caps[idx].supported_flags;
|
||||
|
||||
wmi_debug("fft_size_caps[%u]:: pdev_id:%u sscan_bw:%u"
|
||||
"supported_flags:0x%x",
|
||||
idx, param_buf->sscan_bw_caps[idx].pdev_id,
|
||||
idx, param_buf->fft_size_caps[idx].pdev_id,
|
||||
param_buf->fft_size_caps[idx].sscan_bw,
|
||||
param_buf->sscan_bw_caps[idx].supported_flags);
|
||||
param_buf->fft_size_caps[idx].supported_flags);
|
||||
}
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
@@ -19280,6 +19280,8 @@ static void populate_tlv_events_id(uint32_t *event_ids)
|
||||
event_ids[wmi_coex_dbam_complete_event_id] =
|
||||
WMI_COEX_DBAM_COMPLETE_EVENTID;
|
||||
#endif
|
||||
event_ids[wmi_spectral_capabilities_eventid] =
|
||||
WMI_SPECTRAL_CAPABILITIES_EVENTID;
|
||||
}
|
||||
|
||||
#ifdef WLAN_FEATURE_LINK_LAYER_STATS
|
||||
|
Reference in New Issue
Block a user