qcacmn: Get Spectral bin scaling params

Extended service ready event has a tlv
containing the spectral bin scaling parameters.
Populate the spectral capabilities using this info.

CRs-Fixed: 2379652
Change-Id: I0b4648302e7170b5965cf1aec68638e70cd36e73
This commit is contained in:
Edayilliam Jayadev
2018-08-08 11:51:06 +05:30
committed by nshrivas
vanhempi 27fba324b4
commit ac0ddecb36
12 muutettua tiedostoa jossa 187 lisäystä ja 7 poistoa

Näytä tiedosto

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -172,6 +172,7 @@ struct target_supported_modes {
* @service_ext_param: ext service params
* @mac_phy_cap: phy caps array
* @reg_cap: regulatory caps array
* @scaling_params: Spectral bin scaling parameters
* @num_mem_chunks: number of mem chunks allocated
* @hw_mode_caps: HW mode caps of preferred mode
* @mem_chunks: allocated memory blocks for FW
@@ -196,6 +197,7 @@ struct tgt_info {
struct wlan_psoc_host_mac_phy_caps
mac_phy_cap[PSOC_MAX_MAC_PHY_CAP];
struct wlan_psoc_host_dbr_ring_caps *dbr_ring_cap;
struct wlan_psoc_host_spectral_scaling_params *scaling_params;
uint32_t num_mem_chunks;
struct wmi_host_mem_chunk mem_chunks[MAX_MEM_CHUNKS];
struct wlan_psoc_host_hw_mode_caps hw_mode_cap;

Näytä tiedosto

@@ -552,6 +552,7 @@ QDF_STATUS target_if_free_psoc_tgt_info(struct wlan_objmgr_psoc *psoc)
}
init_deinit_chainmask_table_free(ext_param);
init_deinit_dbr_ring_cap_free(tgt_psoc_info);
init_deinit_spectral_scaling_params_free(tgt_psoc_info);
qdf_event_destroy(&tgt_psoc_info->info.event);

Näytä tiedosto

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -222,6 +222,24 @@ struct wlan_psoc_host_dbr_ring_caps {
uint32_t min_buf_align;
};
/**
* struct wlan_psoc_host_spectral_scaling_params - Spectral scaling params
* @pdev_id: Pdev id of the pdev
* @formula_id: Formula id
* @low_level_offset: Low level offset
* @high_level_offset: High level offset
* @rssi_thr: RSSI threshold
* @default_agc_max_gain: Default agc max gain
*/
struct wlan_psoc_host_spectral_scaling_params {
uint32_t pdev_id;
uint32_t formula_id;
uint32_t low_level_offset;
uint32_t high_level_offset;
uint32_t rssi_thr;
uint32_t default_agc_max_gain;
};
/**
* struct wlan_psoc_host_chainmask_capabilities - chain mask capabilities list
* @supports_chan_width_20: channel width 20 support for this chain mask.
@@ -280,6 +298,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
* @max_bssid_indicator: Maximum number of VAPs in MBSS IE
* @num_bin_scaling_params: Number of Spectral bin scaling parameters
* @chainmask_table: Available chain mask tables.
* @sar_version: SAR version info
*/
@@ -296,6 +315,7 @@ struct wlan_psoc_host_service_ext_param {
uint32_t num_chainmask_tables;
uint32_t num_dbr_ring_caps;
uint32_t max_bssid_indicator;
uint32_t num_bin_scaling_params;
struct wlan_psoc_host_chainmask_table
chainmask_table[PSOC_MAX_CHAINMASK_TABLES];
uint32_t sar_version;

Näytä tiedosto

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -157,6 +157,22 @@ int init_deinit_populate_dbr_ring_cap(struct wlan_objmgr_psoc *psoc,
void *handle, uint8_t *event,
struct tgt_info *info);
/**
* init_deinit_populate_spectral_bin_scale_params() - populate Spectral scaling
* @psoc: PSOC object
* @handle: WMI handle pointer
* @event: event buffer received from FW
* @info: tgt_info object
*
* API to populate Spectral bin scaling parameters
*
* Return: zero on successful parsing of scaling params or failure
*/
int init_deinit_populate_spectral_bin_scale_params(
struct wlan_objmgr_psoc *psoc,
void *handle, uint8_t *event,
struct tgt_info *info);
/**
* init_deinit_dbr_ring_cap_free() - free dbr ring capability
* @tgt_psoc_info: target psoc info object
@@ -168,6 +184,17 @@ int init_deinit_populate_dbr_ring_cap(struct wlan_objmgr_psoc *psoc,
QDF_STATUS init_deinit_dbr_ring_cap_free(
struct target_psoc_info *tgt_psoc_info);
/**
* init_deinit_spectral_scaling_params_free() - free Spectral scaling params
* @tgt_psoc_info: target psoc info object
*
* API to free Spectral scaling params
*
* Return: QDF_STATUS
*/
QDF_STATUS init_deinit_spectral_scaling_params_free(
struct target_psoc_info *tgt_psoc_info);
/**
* init_deinit_populate_phy_reg_cap() - populate phy reg capability
* @psoc: PSOC object

Näytä tiedosto

@@ -268,6 +268,12 @@ static int init_deinit_service_ext_ready_event_handler(ol_scn_t scn_handle,
if (err_code)
goto exit;
err_code = init_deinit_populate_spectral_bin_scale_params(psoc,
wmi_handle,
event, info);
if (err_code)
goto exit;
legacy_callback = target_if_get_psoc_legacy_service_ready_cb();
if (legacy_callback)
legacy_callback(wmi_service_ready_ext_event_id,

Näytä tiedosto

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -389,6 +389,49 @@ free_and_return:
return qdf_status_to_os_return(status);
}
int init_deinit_populate_spectral_bin_scale_params(
struct wlan_objmgr_psoc *psoc, void *handle,
uint8_t *event, struct tgt_info *info)
{
uint8_t param_idx;
uint32_t num_bin_scaling_params;
QDF_STATUS status = QDF_STATUS_SUCCESS;
num_bin_scaling_params = info->service_ext_param.num_bin_scaling_params;
if (!num_bin_scaling_params)
return 0;
info->scaling_params = qdf_mem_malloc(
sizeof(struct wlan_psoc_host_spectral_scaling_params) *
num_bin_scaling_params);
if (!info->scaling_params) {
target_if_err("Mem alloc for bin scaling params failed");
return -EINVAL;
}
for (param_idx = 0; param_idx < num_bin_scaling_params; param_idx++) {
status = wmi_extract_spectral_scaling_params_service_ready_ext(
handle,
event, param_idx,
&info->scaling_params[param_idx]);
if (QDF_IS_STATUS_ERROR(status)) {
target_if_err("Extraction of scaling params failed");
goto free_and_return;
}
}
return 0;
free_and_return:
qdf_mem_free(info->scaling_params);
info->scaling_params = NULL;
return qdf_status_to_os_return(status);
}
QDF_STATUS init_deinit_dbr_ring_cap_free(
struct target_psoc_info *tgt_psoc_info)
{
@@ -403,6 +446,22 @@ QDF_STATUS init_deinit_dbr_ring_cap_free(
}
qdf_export_symbol(init_deinit_dbr_ring_cap_free);
QDF_STATUS init_deinit_spectral_scaling_params_free(
struct target_psoc_info *tgt_psoc_info)
{
QDF_STATUS status = QDF_STATUS_E_FAILURE;
if (tgt_psoc_info->info.scaling_params) {
qdf_mem_free(tgt_psoc_info->info.scaling_params);
tgt_psoc_info->info.scaling_params = NULL;
status = QDF_STATUS_SUCCESS;
}
return status;
}
qdf_export_symbol(init_deinit_spectral_scaling_params_free);
int init_deinit_populate_phy_reg_cap(struct wlan_objmgr_psoc *psoc,
void *handle, uint8_t *event,
struct tgt_info *info, bool service_ready)

Näytä tiedosto

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2013-2019 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -38,6 +38,22 @@ typedef struct wmi_unified *wmi_unified_t;
QDF_STATUS wmi_unified_dbr_ring_cfg(void *wmi_hdl,
struct direct_buf_rx_cfg_req *cfg);
/**
* wmi_extract_spectral_scaling_params_service_ready_ext: Extract Spectral
* scaling params received through
* extended service ready event
* @wmi_hdl: WMI handle
* @evt_buf: Event buffer
* @idx: Index
* @param: Pointer to Spectral scaling params
*
* Return: QDF status of operation
*/
QDF_STATUS wmi_extract_spectral_scaling_params_service_ready_ext(
void *wmi_hdl,
uint8_t *evt_buf, uint8_t idx,
struct wlan_psoc_host_spectral_scaling_params *param);
/**
* wmi_extract_dbr_buf_release_fixed : Extract direct buffer rx fixed param
* from buffer release event

Näytä tiedosto

@@ -1629,6 +1629,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_scaling_params_service_ready_ext)(
wmi_unified_t wmi_handle,
uint8_t *evt_buf, uint8_t idx,
struct wlan_psoc_host_spectral_scaling_params *param);
QDF_STATUS (*extract_sar_cap_service_ready_ext)(
wmi_unified_t wmi_handle,
uint8_t *evt_buf,

Näytä tiedosto

@@ -4061,6 +4061,20 @@ QDF_STATUS wmi_extract_dbr_ring_cap_service_ready_ext(
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_extract_spectral_scaling_params_service_ready_ext(
void *wmi_hdl,
uint8_t *evt_buf, uint8_t idx,
struct wlan_psoc_host_spectral_scaling_params *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
if (wmi_handle->ops->extract_scaling_params_service_ready_ext)
return wmi_handle->ops->extract_scaling_params_service_ready_ext
(wmi_handle, evt_buf, idx, param);
return QDF_STATUS_E_FAILURE;
}
/**
* wmi_extract_pdev_utf_event() -
* extract UTF data from pdev utf event

Näytä tiedosto

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the

Näytä tiedosto

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -85,6 +85,33 @@ static QDF_STATUS send_dbr_cfg_cmd_tlv(wmi_unified_t wmi_handle,
return ret;
}
static QDF_STATUS extract_scaling_params_service_ready_ext_tlv(
wmi_unified_t wmi_handle,
uint8_t *event, uint8_t idx,
struct wlan_psoc_host_spectral_scaling_params *param)
{
WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf;
wmi_spectral_bin_scaling_params *spectral_bin_scaling_params;
param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *)event;
if (!param_buf)
return QDF_STATUS_E_INVAL;
spectral_bin_scaling_params = &param_buf->wmi_bin_scaling_params[idx];
param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host(
spectral_bin_scaling_params->pdev_id);
param->low_level_offset = spectral_bin_scaling_params->low_level_offset;
param->formula_id = spectral_bin_scaling_params->formula_id;
param->high_level_offset =
spectral_bin_scaling_params->high_level_offset;
param->rssi_thr = spectral_bin_scaling_params->rssi_thr;
param->default_agc_max_gain =
spectral_bin_scaling_params->default_agc_max_gain;
return QDF_STATUS_SUCCESS;
}
static QDF_STATUS extract_dbr_buf_release_fixed_tlv(wmi_unified_t wmi_handle,
uint8_t *event, struct direct_buf_rx_rsp *param)
{
@@ -169,4 +196,6 @@ void wmi_dbr_attach_tlv(wmi_unified_t wmi_handle)
ops->extract_dbr_buf_release_entry = extract_dbr_buf_release_entry_tlv;
ops->extract_dbr_buf_metadata = extract_dbr_buf_metadata_tlv;
ops->extract_dbr_buf_release_fixed = extract_dbr_buf_release_fixed_tlv;
ops->extract_scaling_params_service_ready_ext =
extract_scaling_params_service_ready_ext_tlv;
}

Näytä tiedosto

@@ -9063,6 +9063,7 @@ static QDF_STATUS extract_service_ready_ext_tlv(wmi_unified_t wmi_handle,
param->max_bssid_rx_filters = ev->max_bssid_rx_filters;
param->fw_build_vers_ext = ev->fw_build_vers_ext;
param->num_dbr_ring_caps = param_buf->num_dma_ring_caps;
param->num_bin_scaling_params = param_buf->num_wmi_bin_scaling_params;
param->max_bssid_indicator = ev->max_bssid_indicator;
qdf_mem_copy(&param->ppet, &ev->ppet, sizeof(param->ppet));