qcacmn: Add APIs to get Spectral scan capability

Add APIs to check the agile and normal Spectral scan
capability of the target. This information is derived from
the advertisements from halphy via WMI events.

CRs-Fixed: 2840227
Change-Id: I2aae79b3342d8d74a1f4c00e813cae843a71106a
This commit is contained in:
Edayilliam Jayadev
2020-12-17 10:46:25 +05:30
committed by snandini
parent 8f57245a44
commit dac2af9a3b
2 changed files with 146 additions and 29 deletions

View File

@@ -53,6 +53,7 @@ struct spectral_tgt_ops ops_tgt;
* *
* Return: true or false * Return: true or false
*/ */
static
bool target_if_spectral_wmi_service_enabled(struct wlan_objmgr_psoc *psoc, bool target_if_spectral_wmi_service_enabled(struct wlan_objmgr_psoc *psoc,
wmi_unified_t wmi_handle, wmi_unified_t wmi_handle,
uint32_t service_id) uint32_t service_id)
@@ -88,6 +89,7 @@ bool target_if_spectral_wmi_service_enabled(struct wlan_objmgr_psoc *psoc,
* *
* Return: true or false * Return: true or false
*/ */
static
bool target_if_spectral_wmi_service_enabled(struct wlan_objmgr_psoc *psoc, bool target_if_spectral_wmi_service_enabled(struct wlan_objmgr_psoc *psoc,
wmi_unified_t wmi_handle, wmi_unified_t wmi_handle,
uint32_t service_id) uint32_t service_id)
@@ -96,6 +98,126 @@ bool target_if_spectral_wmi_service_enabled(struct wlan_objmgr_psoc *psoc,
} }
#endif /* SPECTRAL_MODULIZED_ENABLE */ #endif /* SPECTRAL_MODULIZED_ENABLE */
/**
* target_if_spectral_get_normal_mode_cap() - API to get normal
* Spectral scan capability of a given pdev
* @pdev: pdev handle
* @normal_mode_disable: Pointer to caller variable
*
* API to get normal Spectral scan mode capability a given pdev.
* This information is derived from the WMI service
* "WMI_SERVICE_SPECTRAL_SCAN_DISABLED".
*
* Return: QDF_STATUS on success
*/
static QDF_STATUS
target_if_spectral_get_normal_mode_cap(struct wlan_objmgr_pdev *pdev,
bool *normal_mode_disable)
{
struct wlan_objmgr_psoc *psoc;
struct wmi_unified *wmi_handle;
struct target_if_psoc_spectral *psoc_spectral;
if (!pdev) {
spectral_err("pdev is null");
return QDF_STATUS_E_INVAL;
}
psoc = wlan_pdev_get_psoc(pdev);
if (!psoc) {
spectral_err("psoc is null");
return QDF_STATUS_E_INVAL;
}
psoc_spectral = get_target_if_spectral_handle_from_psoc(psoc);
if (!psoc_spectral) {
spectral_err("psoc spectral object is null");
return QDF_STATUS_E_INVAL;
}
wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle) {
spectral_err("wmi handle is null");
return QDF_STATUS_E_INVAL;
}
*normal_mode_disable = target_if_spectral_wmi_service_enabled(psoc,
wmi_handle, wmi_service_spectral_scan_disabled);
return QDF_STATUS_SUCCESS;
}
/**
* target_if_spectral_get_agile_mode_cap() - API to check agile
* Spectral scan mode capability of a given pdev.
* @pdev: pdev handle
* @agile_cap: Pointer to caller variable
*
* API to check agile Spectral scan mode is disabled for a given pdev.
* This information is derived from the chain mask table entries.
*
* Return: QDF_STATUS on success
*/
static QDF_STATUS
target_if_spectral_get_agile_mode_cap(
struct wlan_objmgr_pdev *pdev,
struct target_if_spectral_agile_mode_cap *agile_cap)
{
struct wlan_objmgr_psoc *psoc;
struct target_psoc_info *tgt_psoc_info;
struct wlan_psoc_host_mac_phy_caps *mac_phy_cap_arr;
struct wlan_psoc_host_mac_phy_caps *mac_phy_cap;
uint8_t pdev_id, i;
uint32_t table_id;
struct wlan_psoc_host_service_ext_param *ext_svc_param;
struct wlan_psoc_host_chainmask_table *table;
if (!pdev) {
spectral_err("pdev is null");
return QDF_STATUS_E_INVAL;
}
psoc = wlan_pdev_get_psoc(pdev);
if (!psoc) {
spectral_err("psoc is null");
return QDF_STATUS_E_FAILURE;
}
tgt_psoc_info = wlan_psoc_get_tgt_if_handle(psoc);
if (!tgt_psoc_info) {
spectral_err("target_psoc_info is null");
return QDF_STATUS_E_FAILURE;
}
mac_phy_cap_arr = target_psoc_get_mac_phy_cap(tgt_psoc_info);
if (!mac_phy_cap_arr) {
spectral_err("mac phy cap array is null");
return QDF_STATUS_E_FAILURE;
}
pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
mac_phy_cap = &mac_phy_cap_arr[pdev_id];
table_id = mac_phy_cap->chainmask_table_id;
ext_svc_param = target_psoc_get_service_ext_param(tgt_psoc_info);
if (!ext_svc_param) {
spectral_err("Extended service ready params null");
return QDF_STATUS_E_FAILURE;
}
table = &ext_svc_param->chainmask_table[table_id];
for (i = 0; i < table->num_valid_chainmasks; i++) {
agile_cap->agile_spectral_cap |=
table->cap_list[i].supports_aSpectral;
agile_cap->agile_spectral_cap_160 |=
table->cap_list[i].supports_aSpectral_160;
}
agile_cap->agile_spectral_cap_80p80 = agile_cap->agile_spectral_cap_160;
return QDF_STATUS_SUCCESS;
}
static void target_if_spectral_get_firstvdev_pdev(struct wlan_objmgr_pdev *pdev, static void target_if_spectral_get_firstvdev_pdev(struct wlan_objmgr_pdev *pdev,
void *obj, void *arg) void *obj, void *arg)
{ {
@@ -1569,11 +1691,6 @@ target_if_init_spectral_capability(struct target_if_spectral *spectral,
struct target_psoc_info *tgt_psoc_info; struct target_psoc_info *tgt_psoc_info;
struct wlan_psoc_host_service_ext_param *ext_svc_param; struct wlan_psoc_host_service_ext_param *ext_svc_param;
struct spectral_caps *pcap = &spectral->capability; struct spectral_caps *pcap = &spectral->capability;
struct wlan_psoc_host_mac_phy_caps *mac_phy_cap_arr = NULL;
struct wlan_psoc_host_mac_phy_caps *mac_phy_cap = NULL;
struct wlan_psoc_host_chainmask_table *table;
int j;
uint32_t table_id;
pdev = spectral->pdev_obj; pdev = spectral->pdev_obj;
psoc = wlan_pdev_get_psoc(pdev); psoc = wlan_pdev_get_psoc(pdev);
@@ -1601,32 +1718,19 @@ target_if_init_spectral_capability(struct target_if_spectral *spectral,
pcap->advncd_spectral_cap = 1; pcap->advncd_spectral_cap = 1;
pcap->hw_gen = spectral->spectral_gen; pcap->hw_gen = spectral->spectral_gen;
if (spectral->spectral_gen >= SPECTRAL_GEN3) { if (spectral->spectral_gen >= SPECTRAL_GEN3) {
mac_phy_cap_arr = target_psoc_get_mac_phy_cap(tgt_psoc_info); QDF_STATUS status;
if (!mac_phy_cap_arr) { struct target_if_spectral_agile_mode_cap agile_cap = { 0 };
spectral_err("mac phy cap array is null");
status = target_if_spectral_get_agile_mode_cap(pdev,
&agile_cap);
if (QDF_IS_STATUS_ERROR(status)) {
spectral_err("Failed to get agile mode capability");
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
pcap->agile_spectral_cap = agile_cap.agile_spectral_cap;
mac_phy_cap = &mac_phy_cap_arr[pdev_id]; pcap->agile_spectral_cap_160 = agile_cap.agile_spectral_cap_160;
if (!mac_phy_cap) { pcap->agile_spectral_cap_80p80 =
spectral_err("mac phy cap is null"); agile_cap.agile_spectral_cap_80p80;
return QDF_STATUS_E_FAILURE;
}
table_id = mac_phy_cap->chainmask_table_id;
table = &ext_svc_param->chainmask_table[table_id];
if (!table) {
spectral_err("chainmask table not found");
return QDF_STATUS_E_FAILURE;
}
for (j = 0; j < table->num_valid_chainmasks; j++) {
pcap->agile_spectral_cap |=
table->cap_list[j].supports_aSpectral;
pcap->agile_spectral_cap_160 |=
table->cap_list[j].supports_aSpectral_160;
}
pcap->agile_spectral_cap_80p80 = pcap->agile_spectral_cap_160;
} else { } else {
pcap->agile_spectral_cap = false; pcap->agile_spectral_cap = false;
pcap->agile_spectral_cap_160 = false; pcap->agile_spectral_cap_160 = false;

View File

@@ -1239,6 +1239,19 @@ struct target_if_samp_msg_params {
uint32_t target_reset_count; uint32_t target_reset_count;
}; };
/**
* struct target_if_spectral_agile_mode_cap - Structure to hold agile
* Spetcral scan capability
* @agile_spectral_cap: agile Spectral scan capability for 20/40/80 MHz
* @agile_spectral_cap_160: agile Spectral scan capability for 160 MHz
* @agile_spectral_cap_80p80: agile Spectral scan capability for 80+80 MHz
*/
struct target_if_spectral_agile_mode_cap {
bool agile_spectral_cap;
bool agile_spectral_cap_160;
bool agile_spectral_cap_80p80;
};
#ifdef WLAN_CONV_SPECTRAL_ENABLE #ifdef WLAN_CONV_SPECTRAL_ENABLE
/** /**
* target_if_spectral_dump_fft() - Dump Spectral FFT * target_if_spectral_dump_fft() - Dump Spectral FFT