qcacmn: Fix the coding convention issues in Spectral core
Current Spectral core functionality is not following coding convention rules in some places. Change-Id: I2109e510351d254652cbab16f09e52ec463abebb CRs-Fixed: 2151550
This commit is contained in:

committed by
snandini

parent
57a7ff2f9b
commit
f57c0b6262
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011,2017 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2011,2017-2018 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
@@ -68,45 +68,55 @@ spectral_get_vdev(struct wlan_objmgr_pdev *pdev)
|
||||
}
|
||||
|
||||
#ifndef CONFIG_MCL
|
||||
static void spectral_register_cfg80211_handlers(struct wlan_objmgr_pdev *pdev)
|
||||
/**
|
||||
* spectral_register_cfg80211_handlers() - Register spectral cfg80211 handlers
|
||||
* @pdev: Pointer to pdev
|
||||
*
|
||||
* Register spectral cfg80211 handlers
|
||||
* Handlers can be different for WIN and MCL
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
static void
|
||||
spectral_register_cfg80211_handlers(struct wlan_objmgr_pdev *pdev)
|
||||
{
|
||||
wlan_cfg80211_register_spectral_cmd_handler(
|
||||
pdev,
|
||||
SPECTRAL_SCAN_START_HANDLER_IDX,
|
||||
wlan_cfg80211_spectral_scan_config_and_start);
|
||||
pdev,
|
||||
SPECTRAL_SCAN_START_HANDLER_IDX,
|
||||
wlan_cfg80211_spectral_scan_config_and_start);
|
||||
wlan_cfg80211_register_spectral_cmd_handler(
|
||||
pdev,
|
||||
SPECTRAL_SCAN_STOP_HANDLER_IDX,
|
||||
wlan_cfg80211_spectral_scan_stop);
|
||||
pdev,
|
||||
SPECTRAL_SCAN_STOP_HANDLER_IDX,
|
||||
wlan_cfg80211_spectral_scan_stop);
|
||||
wlan_cfg80211_register_spectral_cmd_handler(
|
||||
pdev,
|
||||
SPECTRAL_SCAN_GET_CONFIG_HANDLER_IDX,
|
||||
wlan_cfg80211_spectral_scan_get_config);
|
||||
pdev,
|
||||
SPECTRAL_SCAN_GET_CONFIG_HANDLER_IDX,
|
||||
wlan_cfg80211_spectral_scan_get_config);
|
||||
wlan_cfg80211_register_spectral_cmd_handler(
|
||||
pdev,
|
||||
SPECTRAL_SCAN_GET_DIAG_STATS_HANDLER_IDX,
|
||||
wlan_cfg80211_spectral_scan_get_diag_stats);
|
||||
pdev,
|
||||
SPECTRAL_SCAN_GET_DIAG_STATS_HANDLER_IDX,
|
||||
wlan_cfg80211_spectral_scan_get_diag_stats);
|
||||
wlan_cfg80211_register_spectral_cmd_handler(
|
||||
pdev,
|
||||
SPECTRAL_SCAN_GET_CAP_HANDLER_IDX,
|
||||
wlan_cfg80211_spectral_scan_get_cap);
|
||||
pdev,
|
||||
SPECTRAL_SCAN_GET_CAP_HANDLER_IDX,
|
||||
wlan_cfg80211_spectral_scan_get_cap);
|
||||
wlan_cfg80211_register_spectral_cmd_handler(
|
||||
pdev,
|
||||
SPECTRAL_SCAN_GET_STATUS_HANDLER_IDX,
|
||||
wlan_cfg80211_spectral_scan_get_status);
|
||||
pdev,
|
||||
SPECTRAL_SCAN_GET_STATUS_HANDLER_IDX,
|
||||
wlan_cfg80211_spectral_scan_get_status);
|
||||
}
|
||||
#else
|
||||
static void spectral_register_cfg80211_handlers(struct wlan_objmgr_pdev *pdev)
|
||||
static void
|
||||
spectral_register_cfg80211_handlers(struct wlan_objmgr_pdev *pdev)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
int spectral_control_cmn(
|
||||
struct wlan_objmgr_pdev *pdev,
|
||||
u_int id,
|
||||
void *indata,
|
||||
u_int32_t insize,
|
||||
void *outdata, u_int32_t *outsize)
|
||||
int
|
||||
spectral_control_cmn(struct wlan_objmgr_pdev *pdev,
|
||||
u_int id,
|
||||
void *indata,
|
||||
uint32_t insize, void *outdata, uint32_t *outsize)
|
||||
{
|
||||
int error = 0;
|
||||
int temp_debug;
|
||||
@@ -115,7 +125,7 @@ int spectral_control_cmn(
|
||||
struct spectral_config *spectralparams;
|
||||
struct spectral_context *sc;
|
||||
struct wlan_objmgr_vdev *vdev = NULL;
|
||||
u_int8_t vdev_rxchainmask = 0;
|
||||
uint8_t vdev_rxchainmask = 0;
|
||||
|
||||
if (!pdev) {
|
||||
spectral_err("PDEV is NULL!\n");
|
||||
@@ -131,353 +141,387 @@ int spectral_control_cmn(
|
||||
|
||||
switch (id) {
|
||||
case SPECTRAL_SET_CONFIG:
|
||||
{
|
||||
if (insize < sizeof(struct spectral_config) || !indata) {
|
||||
error = -EINVAL;
|
||||
break;
|
||||
}
|
||||
sp_in = (struct spectral_config *)indata;
|
||||
if (sp_in->ss_count != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (!sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_SCAN_COUNT,
|
||||
sp_in->ss_count))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_fft_period != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (!sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_FFT_PERIOD,
|
||||
sp_in->ss_fft_period))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_period != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (!sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_SCAN_PERIOD,
|
||||
sp_in->ss_period))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_short_report != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (!sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_SHORT_REPORT,
|
||||
(u_int32_t)(sp_in->ss_short_report ? 1 : 0)))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_spectral_pri != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (!sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_SPECT_PRI,
|
||||
(u_int32_t)(sp_in->ss_spectral_pri)))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_fft_size != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (!sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_FFT_SIZE,
|
||||
sp_in->ss_fft_size))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_gc_ena != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (!sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_GC_ENA,
|
||||
sp_in->ss_gc_ena))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_restart_ena != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (!sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_RESTART_ENA,
|
||||
sp_in->ss_restart_ena))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_noise_floor_ref != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (!sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_NOISE_FLOOR_REF,
|
||||
sp_in->ss_noise_floor_ref))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_init_delay != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (!sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_INIT_DELAY,
|
||||
sp_in->ss_init_delay))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_nb_tone_thr != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (!sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_NB_TONE_THR,
|
||||
sp_in->ss_nb_tone_thr))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_str_bin_thr != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (!sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_STR_BIN_THR,
|
||||
sp_in->ss_str_bin_thr))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_wb_rpt_mode != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (!sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_WB_RPT_MODE,
|
||||
sp_in->ss_wb_rpt_mode))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_rssi_rpt_mode != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (!sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_RSSI_RPT_MODE,
|
||||
sp_in->ss_rssi_rpt_mode))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_rssi_thr != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (!sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_RSSI_THR,
|
||||
sp_in->ss_rssi_thr))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_pwr_format != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (!sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_PWR_FORMAT,
|
||||
sp_in->ss_pwr_format))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_rpt_mode != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (!sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_RPT_MODE,
|
||||
sp_in->ss_rpt_mode))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_bin_scale != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (!sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_BIN_SCALE,
|
||||
sp_in->ss_bin_scale))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_dbm_adj != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (!sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_DBM_ADJ,
|
||||
sp_in->ss_dbm_adj))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_chn_mask != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
/* Check if any of the inactive Rx antenna chains is
|
||||
* set active in
|
||||
* spectral chainmask
|
||||
*/
|
||||
vdev = spectral_get_vdev(pdev);
|
||||
if (!vdev) {
|
||||
error = -ENOENT;
|
||||
break;
|
||||
}
|
||||
|
||||
vdev_rxchainmask = wlan_vdev_mlme_get_rxchainmask(vdev);
|
||||
wlan_objmgr_vdev_release_ref(vdev, WLAN_SPECTRAL_ID);
|
||||
|
||||
if (!(sp_in->ss_chn_mask & vdev_rxchainmask)) {
|
||||
qdf_print("Invalid Spectral Chainmask - "
|
||||
"Inactive Rx antenna chain cannot "
|
||||
"be an active spectral chain\n");
|
||||
{
|
||||
if (insize < sizeof(struct spectral_config) ||
|
||||
!indata) {
|
||||
error = -EINVAL;
|
||||
break;
|
||||
} else if (!sc->sptrlc_set_spectral_config(pdev,
|
||||
SPECTRAL_PARAM_CHN_MASK, sp_in->ss_chn_mask)) {
|
||||
error = -EINVAL;
|
||||
}
|
||||
sp_in = (struct spectral_config *)indata;
|
||||
if (sp_in->ss_count !=
|
||||
SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_SCAN_COUNT,
|
||||
sp_in->ss_count))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_fft_period !=
|
||||
SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_FFT_PERIOD,
|
||||
sp_in->ss_fft_period))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_period != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_SCAN_PERIOD,
|
||||
sp_in->ss_period))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_short_report !=
|
||||
SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_SHORT_REPORT,
|
||||
(uint32_t)
|
||||
(sp_in->ss_short_report ? 1 : 0)))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_spectral_pri !=
|
||||
SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_SPECT_PRI,
|
||||
(uint32_t)(sp_in->ss_spectral_pri)))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_fft_size != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_FFT_SIZE,
|
||||
sp_in->ss_fft_size))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_gc_ena != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_GC_ENA,
|
||||
sp_in->ss_gc_ena))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_restart_ena !=
|
||||
SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_RESTART_ENA,
|
||||
sp_in->ss_restart_ena))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_noise_floor_ref !=
|
||||
SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_NOISE_FLOOR_REF,
|
||||
sp_in->ss_noise_floor_ref))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_init_delay !=
|
||||
SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_INIT_DELAY,
|
||||
sp_in->ss_init_delay))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_nb_tone_thr !=
|
||||
SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_NB_TONE_THR,
|
||||
sp_in->ss_nb_tone_thr))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_str_bin_thr !=
|
||||
SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_STR_BIN_THR,
|
||||
sp_in->ss_str_bin_thr))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_wb_rpt_mode !=
|
||||
SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_WB_RPT_MODE,
|
||||
sp_in->ss_wb_rpt_mode))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_rssi_rpt_mode !=
|
||||
SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_RSSI_RPT_MODE,
|
||||
sp_in->ss_rssi_rpt_mode))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_rssi_thr != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_RSSI_THR,
|
||||
sp_in->ss_rssi_thr))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_pwr_format !=
|
||||
SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_PWR_FORMAT,
|
||||
sp_in->ss_pwr_format))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_rpt_mode != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_RPT_MODE,
|
||||
sp_in->ss_rpt_mode))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_bin_scale !=
|
||||
SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_BIN_SCALE,
|
||||
sp_in->ss_bin_scale))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_dbm_adj != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
if (sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_DBM_ADJ,
|
||||
sp_in->ss_dbm_adj))
|
||||
error = -EINVAL;
|
||||
}
|
||||
|
||||
if (sp_in->ss_chn_mask != SPECTRAL_PHYERR_PARAM_NOVAL) {
|
||||
/*
|
||||
* Check if any of the inactive Rx antenna
|
||||
* chains is set active in spectral chainmask
|
||||
*/
|
||||
vdev = spectral_get_vdev(pdev);
|
||||
if (!vdev) {
|
||||
error = -ENOENT;
|
||||
break;
|
||||
}
|
||||
|
||||
vdev_rxchainmask =
|
||||
wlan_vdev_mlme_get_rxchainmask(vdev);
|
||||
wlan_objmgr_vdev_release_ref(vdev,
|
||||
WLAN_SPECTRAL_ID);
|
||||
|
||||
if (!(sp_in->ss_chn_mask & vdev_rxchainmask)) {
|
||||
qdf_print
|
||||
("Invalid Spectral Chainmask - "
|
||||
"Inactive Rx antenna chain cannot "
|
||||
"be an active spectral chain\n");
|
||||
error = -EINVAL;
|
||||
break;
|
||||
} else if (sc->sptrlc_set_spectral_config(
|
||||
pdev,
|
||||
SPECTRAL_PARAM_CHN_MASK,
|
||||
sp_in->ss_chn_mask)) {
|
||||
error = -EINVAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case SPECTRAL_GET_CONFIG:
|
||||
{
|
||||
if (!outdata || !outsize || (*outsize < sizeof(
|
||||
struct spectral_config))) {
|
||||
error = -EINVAL;
|
||||
break;
|
||||
{
|
||||
if (!outdata || !outsize ||
|
||||
(*outsize < sizeof(struct spectral_config))) {
|
||||
error = -EINVAL;
|
||||
break;
|
||||
}
|
||||
*outsize = sizeof(struct spectral_config);
|
||||
sc->sptrlc_get_spectral_config(pdev, &sp_out);
|
||||
spectralparams = (struct spectral_config *)outdata;
|
||||
spectralparams->ss_fft_period = sp_out.ss_fft_period;
|
||||
spectralparams->ss_period = sp_out.ss_period;
|
||||
spectralparams->ss_count = sp_out.ss_count;
|
||||
spectralparams->ss_short_report =
|
||||
sp_out.ss_short_report;
|
||||
spectralparams->ss_spectral_pri =
|
||||
sp_out.ss_spectral_pri;
|
||||
spectralparams->ss_fft_size = sp_out.ss_fft_size;
|
||||
spectralparams->ss_gc_ena = sp_out.ss_gc_ena;
|
||||
spectralparams->ss_restart_ena = sp_out.ss_restart_ena;
|
||||
spectralparams->ss_noise_floor_ref =
|
||||
sp_out.ss_noise_floor_ref;
|
||||
spectralparams->ss_init_delay = sp_out.ss_init_delay;
|
||||
spectralparams->ss_nb_tone_thr = sp_out.ss_nb_tone_thr;
|
||||
spectralparams->ss_str_bin_thr = sp_out.ss_str_bin_thr;
|
||||
spectralparams->ss_wb_rpt_mode = sp_out.ss_wb_rpt_mode;
|
||||
spectralparams->ss_rssi_rpt_mode =
|
||||
sp_out.ss_rssi_rpt_mode;
|
||||
spectralparams->ss_rssi_thr = sp_out.ss_rssi_thr;
|
||||
spectralparams->ss_pwr_format = sp_out.ss_pwr_format;
|
||||
spectralparams->ss_rpt_mode = sp_out.ss_rpt_mode;
|
||||
spectralparams->ss_bin_scale = sp_out.ss_bin_scale;
|
||||
spectralparams->ss_dbm_adj = sp_out.ss_dbm_adj;
|
||||
spectralparams->ss_chn_mask = sp_out.ss_chn_mask;
|
||||
}
|
||||
*outsize = sizeof(struct spectral_config);
|
||||
sc->sptrlc_get_spectral_config(pdev, &sp_out);
|
||||
spectralparams = (struct spectral_config *)outdata;
|
||||
spectralparams->ss_fft_period = sp_out.ss_fft_period;
|
||||
spectralparams->ss_period = sp_out.ss_period;
|
||||
spectralparams->ss_count = sp_out.ss_count;
|
||||
spectralparams->ss_short_report = sp_out.ss_short_report;
|
||||
spectralparams->ss_spectral_pri = sp_out.ss_spectral_pri;
|
||||
spectralparams->ss_fft_size = sp_out.ss_fft_size;
|
||||
spectralparams->ss_gc_ena = sp_out.ss_gc_ena;
|
||||
spectralparams->ss_restart_ena = sp_out.ss_restart_ena;
|
||||
spectralparams->ss_noise_floor_ref = sp_out.ss_noise_floor_ref;
|
||||
spectralparams->ss_init_delay = sp_out.ss_init_delay;
|
||||
spectralparams->ss_nb_tone_thr = sp_out.ss_nb_tone_thr;
|
||||
spectralparams->ss_str_bin_thr = sp_out.ss_str_bin_thr;
|
||||
spectralparams->ss_wb_rpt_mode = sp_out.ss_wb_rpt_mode;
|
||||
spectralparams->ss_rssi_rpt_mode = sp_out.ss_rssi_rpt_mode;
|
||||
spectralparams->ss_rssi_thr = sp_out.ss_rssi_thr;
|
||||
spectralparams->ss_pwr_format = sp_out.ss_pwr_format;
|
||||
spectralparams->ss_rpt_mode = sp_out.ss_rpt_mode;
|
||||
spectralparams->ss_bin_scale = sp_out.ss_bin_scale;
|
||||
spectralparams->ss_dbm_adj = sp_out.ss_dbm_adj;
|
||||
spectralparams->ss_chn_mask = sp_out.ss_chn_mask;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case SPECTRAL_IS_ACTIVE:
|
||||
{
|
||||
if (!outdata || !outsize || *outsize < sizeof(u_int32_t)) {
|
||||
error = -EINVAL;
|
||||
break;
|
||||
{
|
||||
if (!outdata || !outsize ||
|
||||
*outsize < sizeof(uint32_t)) {
|
||||
error = -EINVAL;
|
||||
break;
|
||||
}
|
||||
*outsize = sizeof(uint32_t);
|
||||
*((uint32_t *)outdata) =
|
||||
(uint32_t)sc->sptrlc_is_spectral_active(pdev);
|
||||
}
|
||||
*outsize = sizeof(u_int32_t);
|
||||
*((u_int32_t *)outdata) =
|
||||
(u_int32_t)sc->sptrlc_is_spectral_active(pdev);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case SPECTRAL_IS_ENABLED:
|
||||
{
|
||||
if (!outdata || !outsize || *outsize < sizeof(u_int32_t)) {
|
||||
error = -EINVAL;
|
||||
break;
|
||||
{
|
||||
if (!outdata || !outsize ||
|
||||
*outsize < sizeof(uint32_t)) {
|
||||
error = -EINVAL;
|
||||
break;
|
||||
}
|
||||
*outsize = sizeof(uint32_t);
|
||||
*((uint32_t *)outdata) =
|
||||
(uint32_t)sc->sptrlc_is_spectral_enabled(pdev);
|
||||
}
|
||||
*outsize = sizeof(u_int32_t);
|
||||
*((u_int32_t *)outdata) =
|
||||
(u_int32_t)sc->sptrlc_is_spectral_enabled(pdev);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case SPECTRAL_SET_DEBUG_LEVEL:
|
||||
{
|
||||
if (insize < sizeof(u_int32_t) || !indata) {
|
||||
error = -EINVAL;
|
||||
break;
|
||||
{
|
||||
if (insize < sizeof(uint32_t) || !indata) {
|
||||
error = -EINVAL;
|
||||
break;
|
||||
}
|
||||
temp_debug = *(uint32_t *)indata;
|
||||
sc->sptrlc_set_debug_level(pdev, temp_debug);
|
||||
}
|
||||
temp_debug = *(u_int32_t *)indata;
|
||||
sc->sptrlc_set_debug_level(pdev, temp_debug);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case SPECTRAL_GET_DEBUG_LEVEL:
|
||||
{
|
||||
if (!outdata || !outsize || *outsize < sizeof(u_int32_t)) {
|
||||
error = -EINVAL;
|
||||
break;
|
||||
case SPECTRAL_GET_DEBUG_LEVEL:
|
||||
{
|
||||
if (!outdata || !outsize ||
|
||||
*outsize < sizeof(uint32_t)) {
|
||||
error = -EINVAL;
|
||||
break;
|
||||
}
|
||||
*outsize = sizeof(uint32_t);
|
||||
*((uint32_t *)outdata) =
|
||||
(uint32_t)sc->sptrlc_get_debug_level(pdev);
|
||||
}
|
||||
*outsize = sizeof(u_int32_t);
|
||||
*((u_int32_t *)outdata) =
|
||||
(u_int32_t)sc->sptrlc_get_debug_level(pdev);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case SPECTRAL_ACTIVATE_SCAN:
|
||||
{
|
||||
sc->sptrlc_start_spectral_scan(pdev);
|
||||
}
|
||||
break;
|
||||
{
|
||||
sc->sptrlc_start_spectral_scan(pdev);
|
||||
}
|
||||
break;
|
||||
|
||||
case SPECTRAL_STOP_SCAN:
|
||||
{
|
||||
sc->sptrlc_stop_spectral_scan(pdev);
|
||||
}
|
||||
break;
|
||||
{
|
||||
sc->sptrlc_stop_spectral_scan(pdev);
|
||||
}
|
||||
break;
|
||||
|
||||
case SPECTRAL_GET_CAPABILITY_INFO:
|
||||
{
|
||||
if (!outdata || !outsize ||
|
||||
*outsize < sizeof(struct spectral_caps)) {
|
||||
error = -EINVAL;
|
||||
break;
|
||||
{
|
||||
if (!outdata || !outsize ||
|
||||
*outsize < sizeof(struct spectral_caps)) {
|
||||
error = -EINVAL;
|
||||
break;
|
||||
}
|
||||
*outsize = sizeof(struct spectral_caps);
|
||||
sc->sptrlc_get_spectral_capinfo(pdev, outdata);
|
||||
}
|
||||
*outsize = sizeof(struct spectral_caps);
|
||||
sc->sptrlc_get_spectral_capinfo(pdev, outdata);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case SPECTRAL_GET_DIAG_STATS:
|
||||
{
|
||||
if (!outdata || !outsize ||
|
||||
(*outsize < sizeof(struct spectral_diag_stats))) {
|
||||
error = -EINVAL;
|
||||
break;
|
||||
{
|
||||
if (!outdata || !outsize ||
|
||||
(*outsize < sizeof(struct spectral_diag_stats))) {
|
||||
error = -EINVAL;
|
||||
break;
|
||||
}
|
||||
*outsize = sizeof(struct spectral_diag_stats);
|
||||
sc->sptrlc_get_spectral_diagstats(pdev, outdata);
|
||||
}
|
||||
*outsize = sizeof(struct spectral_diag_stats);
|
||||
sc->sptrlc_get_spectral_diagstats(pdev, outdata);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case SPECTRAL_GET_CHAN_WIDTH:
|
||||
{
|
||||
u_int32_t chan_width;
|
||||
{
|
||||
uint32_t chan_width;
|
||||
|
||||
vdev = spectral_get_vdev(pdev);
|
||||
if (!vdev)
|
||||
return -ENOENT;
|
||||
vdev = spectral_get_vdev(pdev);
|
||||
if (!vdev)
|
||||
return -ENOENT;
|
||||
|
||||
chan_width = spectral_vdev_get_ch_width(vdev);
|
||||
wlan_objmgr_vdev_release_ref(vdev, WLAN_SPECTRAL_ID);
|
||||
chan_width = spectral_vdev_get_ch_width(vdev);
|
||||
wlan_objmgr_vdev_release_ref(vdev, WLAN_SPECTRAL_ID);
|
||||
|
||||
if (!outdata || !outsize ||
|
||||
*outsize < sizeof(chan_width)) {
|
||||
error = -EINVAL;
|
||||
break;
|
||||
if (!outdata || !outsize ||
|
||||
*outsize < sizeof(chan_width)) {
|
||||
error = -EINVAL;
|
||||
break;
|
||||
}
|
||||
*outsize = sizeof(chan_width);
|
||||
*((uint32_t *)outdata) = (uint32_t)chan_width;
|
||||
}
|
||||
*outsize = sizeof(chan_width);
|
||||
*((u_int32_t *)outdata) = (u_int32_t)chan_width;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
error = -EINVAL;
|
||||
break;
|
||||
error = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
bad:
|
||||
bad:
|
||||
return error;
|
||||
}
|
||||
|
||||
static void spectral_ctx_deinit(struct spectral_context *sc)
|
||||
/**
|
||||
* spectral_ctx_deinit() - De-initialize function pointers from spectral context
|
||||
* @sc - Reference to spectral_context object
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
static void
|
||||
spectral_ctx_deinit(struct spectral_context *sc)
|
||||
{
|
||||
if (sc) {
|
||||
sc->sptrlc_ucfg_phyerr_config = NULL;
|
||||
sc->sptrlc_pdev_spectral_init = NULL;
|
||||
sc->sptrlc_pdev_spectral_deinit = NULL;
|
||||
sc->sptrlc_set_spectral_config = NULL;
|
||||
sc->sptrlc_get_spectral_config = NULL;
|
||||
sc->sptrlc_start_spectral_scan = NULL;
|
||||
sc->sptrlc_stop_spectral_scan = NULL;
|
||||
sc->sptrlc_is_spectral_active = NULL;
|
||||
sc->sptrlc_is_spectral_enabled = NULL;
|
||||
sc->sptrlc_set_debug_level = NULL;
|
||||
sc->sptrlc_get_debug_level = NULL;
|
||||
sc->sptrlc_get_spectral_capinfo = NULL;
|
||||
sc->sptrlc_ucfg_phyerr_config = NULL;
|
||||
sc->sptrlc_pdev_spectral_init = NULL;
|
||||
sc->sptrlc_pdev_spectral_deinit = NULL;
|
||||
sc->sptrlc_set_spectral_config = NULL;
|
||||
sc->sptrlc_get_spectral_config = NULL;
|
||||
sc->sptrlc_start_spectral_scan = NULL;
|
||||
sc->sptrlc_stop_spectral_scan = NULL;
|
||||
sc->sptrlc_is_spectral_active = NULL;
|
||||
sc->sptrlc_is_spectral_enabled = NULL;
|
||||
sc->sptrlc_set_debug_level = NULL;
|
||||
sc->sptrlc_get_debug_level = NULL;
|
||||
sc->sptrlc_get_spectral_capinfo = NULL;
|
||||
sc->sptrlc_get_spectral_diagstats = NULL;
|
||||
}
|
||||
}
|
||||
@@ -491,8 +535,8 @@ wlan_spectral_psoc_obj_create_handler(struct wlan_objmgr_psoc *psoc, void *arg)
|
||||
spectral_err("PSOC is NULL\n");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
sc = (struct spectral_context *)qdf_mem_malloc(
|
||||
sizeof(struct spectral_context));
|
||||
sc = (struct spectral_context *)
|
||||
qdf_mem_malloc(sizeof(struct spectral_context));
|
||||
if (!sc) {
|
||||
spectral_err("Failed to allocate spectral_ctx object\n");
|
||||
return QDF_STATUS_E_NOMEM;
|
||||
@@ -511,9 +555,9 @@ wlan_spectral_psoc_obj_create_handler(struct wlan_objmgr_psoc *psoc, void *arg)
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
QDF_STATUS wlan_spectral_psoc_obj_destroy_handler(
|
||||
struct wlan_objmgr_psoc *psoc,
|
||||
void *arg)
|
||||
QDF_STATUS
|
||||
wlan_spectral_psoc_obj_destroy_handler(struct wlan_objmgr_psoc *psoc,
|
||||
void *arg)
|
||||
{
|
||||
struct spectral_context *sc = NULL;
|
||||
|
||||
@@ -521,13 +565,11 @@ QDF_STATUS wlan_spectral_psoc_obj_destroy_handler(
|
||||
spectral_err("PSOC is NULL\n");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
sc = wlan_objmgr_psoc_get_comp_private_obj(
|
||||
psoc,
|
||||
WLAN_UMAC_COMP_SPECTRAL);
|
||||
sc = wlan_objmgr_psoc_get_comp_private_obj(psoc,
|
||||
WLAN_UMAC_COMP_SPECTRAL);
|
||||
if (sc) {
|
||||
wlan_objmgr_psoc_component_obj_detach(
|
||||
psoc,
|
||||
WLAN_UMAC_COMP_SPECTRAL,
|
||||
wlan_objmgr_psoc_component_obj_detach(psoc,
|
||||
WLAN_UMAC_COMP_SPECTRAL,
|
||||
(void *)sc);
|
||||
/* Deinitilise function pointers from spectral context */
|
||||
spectral_ctx_deinit(sc);
|
||||
@@ -548,8 +590,8 @@ wlan_spectral_pdev_obj_create_handler(struct wlan_objmgr_pdev *pdev, void *arg)
|
||||
spectral_err("PDEV is NULL\n");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
ps = (struct pdev_spectral *)qdf_mem_malloc(
|
||||
sizeof(struct pdev_spectral));
|
||||
ps = (struct pdev_spectral *)
|
||||
qdf_mem_malloc(sizeof(struct pdev_spectral));
|
||||
if (!ps) {
|
||||
spectral_err("Failed to allocate pdev_spectral object\n");
|
||||
return QDF_STATUS_E_NOMEM;
|
||||
@@ -576,13 +618,14 @@ wlan_spectral_pdev_obj_create_handler(struct wlan_objmgr_pdev *pdev, void *arg)
|
||||
(void *)ps, QDF_STATUS_SUCCESS);
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
cleanup:
|
||||
cleanup:
|
||||
qdf_mem_free(ps);
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
QDF_STATUS
|
||||
wlan_spectral_pdev_obj_destroy_handler(struct wlan_objmgr_pdev *pdev, void *arg)
|
||||
wlan_spectral_pdev_obj_destroy_handler(struct wlan_objmgr_pdev *pdev,
|
||||
void *arg)
|
||||
{
|
||||
struct pdev_spectral *ps = NULL;
|
||||
struct spectral_context *sc = NULL;
|
||||
@@ -596,20 +639,17 @@ wlan_spectral_pdev_obj_destroy_handler(struct wlan_objmgr_pdev *pdev, void *arg)
|
||||
spectral_err("Spectral context is NULL!\n");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
ps = wlan_objmgr_pdev_get_comp_private_obj(
|
||||
pdev,
|
||||
WLAN_UMAC_COMP_SPECTRAL);
|
||||
ps = wlan_objmgr_pdev_get_comp_private_obj(pdev,
|
||||
WLAN_UMAC_COMP_SPECTRAL);
|
||||
if (ps) {
|
||||
if (sc->sptrlc_pdev_spectral_deinit)
|
||||
sc->sptrlc_pdev_spectral_deinit(pdev);
|
||||
ps->psptrl_target_handle = NULL;
|
||||
wlan_objmgr_pdev_component_obj_detach(
|
||||
pdev,
|
||||
WLAN_UMAC_COMP_SPECTRAL,
|
||||
wlan_objmgr_pdev_component_obj_detach(pdev,
|
||||
WLAN_UMAC_COMP_SPECTRAL,
|
||||
(void *)ps);
|
||||
qdf_mem_free(ps);
|
||||
}
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user