qcacmn: Add Host support for Spectral FFT recapture

Add support to receive the fft_recapture arg value
from spectraltool, handle the FFT recapture config and
pass this to FW. The recapture feature must be
enabled only for spectral scan period > 52 us and
Normal Spectral scans.

Change-Id: Ied637704d25bb15bff2139a215da7481d4f80e4f
CRs-Fixed: 3140890
This commit is contained in:
Jhalak Naik 2022-03-07 19:58:56 +05:30 committed by Madan Koyyalamudi
parent b64b200ff8
commit 055dfbe881
5 changed files with 52 additions and 17 deletions

View File

@ -7700,6 +7700,13 @@ enum qca_wlan_vendor_attr_spectral_scan {
* for the current operating bandwidth.
*/
QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CONFIG_BANDWIDTH = 30,
/* Spectral FFT recapture flag attribute, to enable/disable FFT
* recapture. Recapture can only be enabled for Scan period greater
* than 52us.
* If this attribute is enabled, re-triggers will be enabled in uCode
* when AGC gain changes.
*/
QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CONFIG_FFT_RECAPTURE = 31,
QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CONFIG_AFTER_LAST,
QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CONFIG_MAX =

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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
@ -93,6 +94,8 @@ const struct nla_policy spectral_scan_policy[
.type = NLA_U8},
[QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CONFIG_BANDWIDTH] = {
.type = NLA_U8},
[QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CONFIG_FFT_RECAPTURE] = {
.type = NLA_U32},
};
const struct nla_policy spectral_scan_get_status_policy[
@ -107,6 +110,7 @@ const struct nla_policy spectral_scan_get_status_policy[
static void wlan_spectral_intit_config(struct spectral_config *config_req)
{
config_req->ss_period = SPECTRAL_PHYERR_PARAM_NOVAL;
config_req->ss_recapture = SPECTRAL_PHYERR_PARAM_NOVAL;
config_req->ss_count = SPECTRAL_PHYERR_PARAM_NOVAL;
config_req->ss_fft_period = SPECTRAL_PHYERR_PARAM_NOVAL;
config_req->ss_short_report = SPECTRAL_PHYERR_PARAM_NOVAL;
@ -397,6 +401,10 @@ int wlan_cfg80211_spectral_scan_config_and_start(struct wiphy *wiphy,
config_req.ss_period = nla_get_u32(tb
[QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CONFIG_SCAN_PERIOD]);
if (tb[QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CONFIG_FFT_RECAPTURE])
config_req.ss_recapture = nla_get_u32(tb
[QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CONFIG_FFT_RECAPTURE]);
if (tb[QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CONFIG_PRIORITY])
config_req.ss_spectral_pri = nla_get_u32(tb
[QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CONFIG_PRIORITY]);
@ -806,7 +814,10 @@ int wlan_cfg80211_spectral_scan_get_config(struct wiphy *wiphy,
sconfig->ss_frequency.cfreq2) ||
nla_put_u8(skb,
QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CONFIG_BANDWIDTH,
sscan_bw_nl))
sscan_bw_nl) ||
nla_put_u32(skb,
QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CONFIG_FFT_RECAPTURE,
sconfig->ss_recapture))
goto fail;

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2011,2017-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
*
* Permission to use, copy, modify, and/or distribute this software for
@ -162,6 +163,15 @@ spectral_control_cmn(struct wlan_objmgr_pdev *pdev,
goto bad;
}
if (sp_in->ss_recapture != SPECTRAL_PHYERR_PARAM_NOVAL) {
param.id = SPECTRAL_PARAM_FFT_RECAPTURE;
param.value = sp_in->ss_recapture;
ret = sc->sptrlc_set_spectral_config
(pdev, &param, smode, err);
if (QDF_IS_STATUS_ERROR(ret))
goto bad;
}
if (sp_in->ss_short_report != SPECTRAL_PHYERR_PARAM_NOVAL) {
param.id = SPECTRAL_PARAM_SHORT_REPORT;
param.value = (uint32_t)sp_in->ss_short_report ? 1 : 0;
@ -359,6 +369,7 @@ spectral_control_cmn(struct wlan_objmgr_pdev *pdev,
spectralparams = &sscan_req->config_req.sscan_config;
spectralparams->ss_fft_period = sp_out.ss_fft_period;
spectralparams->ss_period = sp_out.ss_period;
spectralparams->ss_recapture = sp_out.ss_recapture;
spectralparams->ss_count = sp_out.ss_count;
spectralparams->ss_short_report =
sp_out.ss_short_report;

View File

@ -70,6 +70,7 @@
enum spectral_params {
SPECTRAL_PARAM_FFT_PERIOD,
SPECTRAL_PARAM_SCAN_PERIOD,
SPECTRAL_PARAM_FFT_RECAPTURE,
SPECTRAL_PARAM_SCAN_COUNT,
SPECTRAL_PARAM_SHORT_REPORT,
SPECTRAL_PARAM_SPECT_PRI,

View File

@ -1775,17 +1775,6 @@ target_if_sops_stop_spectral_scan(void *arg, enum spectral_scan_mode smode)
p_sops->configure_spectral(spectral, sparams, smode);
}
if (ret == 0 && smode == SPECTRAL_SCAN_MODE_NORMAL) {
struct target_if_spectral_ops *p_sops;
struct spectral_config *sparams;
p_sops = GET_TARGET_IF_SPECTRAL_OPS(spectral);
sparams = &spectral->params[smode];
sparams->ss_recapture = false;
p_sops->configure_spectral(spectral, sparams, smode);
}
return ret;
}
@ -4431,12 +4420,28 @@ _target_if_set_spectral_config(struct target_if_spectral *spectral,
break;
case SPECTRAL_PARAM_SCAN_PERIOD:
sparams->ss_period = param->value;
if ((sparams->ss_period >=
SPECTRAL_RECAPTURE_SCAN_PERIOD_THRESHOLD) &&
(smode == SPECTRAL_SCAN_MODE_NORMAL))
sparams->ss_recapture = true;
else
if (sparams->ss_recapture && ((sparams->ss_period <
SPECTRAL_RECAPTURE_SCAN_PERIOD_THRESHOLD) ||
(smode == SPECTRAL_SCAN_MODE_AGILE))) {
sparams->ss_recapture = false;
spectral_err("FFT recapture cannot be enabled due to scan period: %d us or spectral scan mode: %d",
sparams->ss_period, smode);
}
break;
case SPECTRAL_PARAM_FFT_RECAPTURE:
if (param->value) {
if (sparams->ss_period >=
SPECTRAL_RECAPTURE_SCAN_PERIOD_THRESHOLD &&
smode == SPECTRAL_SCAN_MODE_NORMAL) {
sparams->ss_recapture = true;
} else {
spectral_err("FFT recapture cannot be enabled due to scan period: %d us or spectral scan mode: %d",
sparams->ss_period, smode);
sparams->ss_recapture = false;
}
} else {
sparams->ss_recapture = false;
}
break;
case SPECTRAL_PARAM_SCAN_COUNT:
sparams->ss_count = param->value;