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:
Shiva Krishna Pittala
2018-01-25 18:51:58 +05:30
committed by snandini
parent 57a7ff2f9b
commit f57c0b6262
8 changed files with 829 additions and 542 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017 The Linux Foundation. All rights reserved. * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
* *
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
@@ -23,7 +23,7 @@
#include "spectral_defs_i.h" #include "spectral_defs_i.h"
/** /**
* wlan_spectral_psoc_obj_create_handler(): handler for psoc object create * wlan_spectral_psoc_obj_create_handler() - handler for psoc object create
* @psoc: reference to global psoc object * @psoc: reference to global psoc object
* @arg: reference to argument provided during registration of handler * @arg: reference to argument provided during registration of handler
* *
@@ -35,10 +35,10 @@
* QDF_STATUS_E_NOMEM on failure of spectral object allocation * QDF_STATUS_E_NOMEM on failure of spectral object allocation
*/ */
QDF_STATUS wlan_spectral_psoc_obj_create_handler(struct wlan_objmgr_psoc *psoc, QDF_STATUS wlan_spectral_psoc_obj_create_handler(struct wlan_objmgr_psoc *psoc,
void *arg); void *arg);
/** /**
* wlan_spectral_psoc_obj_destroy_handler(): handler for psoc object delete * wlan_spectral_psoc_obj_destroy_handler() - handler for psoc object delete
* @psoc: reference to global psoc object * @psoc: reference to global psoc object
* @arg: reference to argument provided during registration of handler * @arg: reference to argument provided during registration of handler
* *
@@ -53,7 +53,7 @@ QDF_STATUS wlan_spectral_psoc_obj_destroy_handler(struct wlan_objmgr_psoc *psoc,
void *arg); void *arg);
/** /**
* wlan_spectral_pdev_obj_create_handler(): handler for pdev object create * wlan_spectral_pdev_obj_create_handler() - handler for pdev object create
* @pdev: reference to global pdev object * @pdev: reference to global pdev object
* @arg: reference to argument provided during registration of handler * @arg: reference to argument provided during registration of handler
* *
@@ -68,7 +68,7 @@ QDF_STATUS wlan_spectral_pdev_obj_create_handler(struct wlan_objmgr_pdev *pdev,
void *arg); void *arg);
/** /**
* wlan_spectral_pdev_obj_destroy_handler(): handler for pdev object delete * wlan_spectral_pdev_obj_destroy_handler() - handler for pdev object delete
* @pdev: reference to global pdev object * @pdev: reference to global pdev object
* @arg: reference to argument provided during registration of handler * @arg: reference to argument provided during registration of handler
* *
@@ -83,7 +83,7 @@ QDF_STATUS wlan_spectral_pdev_obj_destroy_handler(struct wlan_objmgr_pdev *pdev,
void *arg); void *arg);
/** /**
* spectral_control_cmn(): common handler for demultiplexing requests from * spectral_control_cmn()- common handler for demultiplexing requests from
* higher layer * higher layer
* @pdev: reference to global pdev object * @pdev: reference to global pdev object
* @id: spectral config command id * @id: spectral config command id
@@ -97,12 +97,10 @@ QDF_STATUS wlan_spectral_pdev_obj_destroy_handler(struct wlan_objmgr_pdev *pdev,
* *
* Return: 0 success else failure * Return: 0 success else failure
*/ */
int spectral_control_cmn( int spectral_control_cmn(struct wlan_objmgr_pdev *pdev,
struct wlan_objmgr_pdev *pdev, u_int id,
u_int id, void *indata,
void *indata, uint32_t insize, void *outdata, uint32_t *outsize);
u_int32_t insize,
void *outdata, u_int32_t *outsize);
/** /**
* spectral_control_ol(): Offload handler for demultiplexing requests from * spectral_control_ol(): Offload handler for demultiplexing requests from
@@ -121,7 +119,7 @@ int spectral_control_cmn(
*/ */
int spectral_control_ol( int spectral_control_ol(
struct wlan_objmgr_pdev *pdev, u_int id, struct wlan_objmgr_pdev *pdev, u_int id,
void *indata, u_int32_t insize, void *outdata, u_int32_t *outsize); void *indata, uint32_t insize, void *outdata, uint32_t *outsize);
/** /**
* spectral_get_spectral_ctx_from_pdev() - API to get spectral context object * spectral_get_spectral_ctx_from_pdev() - API to get spectral context object
@@ -133,9 +131,8 @@ int spectral_control_ol(
* *
* Return : Reference to spectral_context object * Return : Reference to spectral_context object
*/ */
static inline static inline struct spectral_context *
struct spectral_context *spectral_get_spectral_ctx_from_pdev( spectral_get_spectral_ctx_from_pdev(struct wlan_objmgr_pdev *pdev)
struct wlan_objmgr_pdev *pdev)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
struct spectral_context *sc = NULL; struct spectral_context *sc = NULL;
@@ -160,9 +157,8 @@ struct spectral_context *spectral_get_spectral_ctx_from_pdev(
* *
* Return : Reference to spectral_context object * Return : Reference to spectral_context object
*/ */
static inline static inline struct spectral_context *
struct spectral_context *spectral_get_spectral_ctx_from_psoc( spectral_get_spectral_ctx_from_psoc(struct wlan_objmgr_psoc *psoc)
struct wlan_objmgr_psoc *psoc)
{ {
struct spectral_context *sc = NULL; struct spectral_context *sc = NULL;
@@ -185,9 +181,8 @@ struct spectral_context *spectral_get_spectral_ctx_from_psoc(
* *
* Return : Reference to spectral_context object * Return : Reference to spectral_context object
*/ */
static inline static inline struct spectral_context *
struct spectral_context *spectral_get_spectral_ctx_from_vdev( spectral_get_spectral_ctx_from_vdev(struct wlan_objmgr_vdev *vdev)
struct wlan_objmgr_vdev *vdev)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
struct spectral_context *sc = NULL; struct spectral_context *sc = NULL;
@@ -201,5 +196,4 @@ struct spectral_context *spectral_get_spectral_ctx_from_vdev(
return sc; return sc;
} }
#endif /* _SPECTRAL_CMN_API_I_H_*/ #endif /* _SPECTRAL_CMN_API_I_H_ */

View File

@@ -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 * 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 #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( wlan_cfg80211_register_spectral_cmd_handler(
pdev, pdev,
SPECTRAL_SCAN_START_HANDLER_IDX, SPECTRAL_SCAN_START_HANDLER_IDX,
wlan_cfg80211_spectral_scan_config_and_start); wlan_cfg80211_spectral_scan_config_and_start);
wlan_cfg80211_register_spectral_cmd_handler( wlan_cfg80211_register_spectral_cmd_handler(
pdev, pdev,
SPECTRAL_SCAN_STOP_HANDLER_IDX, SPECTRAL_SCAN_STOP_HANDLER_IDX,
wlan_cfg80211_spectral_scan_stop); wlan_cfg80211_spectral_scan_stop);
wlan_cfg80211_register_spectral_cmd_handler( wlan_cfg80211_register_spectral_cmd_handler(
pdev, pdev,
SPECTRAL_SCAN_GET_CONFIG_HANDLER_IDX, SPECTRAL_SCAN_GET_CONFIG_HANDLER_IDX,
wlan_cfg80211_spectral_scan_get_config); wlan_cfg80211_spectral_scan_get_config);
wlan_cfg80211_register_spectral_cmd_handler( wlan_cfg80211_register_spectral_cmd_handler(
pdev, pdev,
SPECTRAL_SCAN_GET_DIAG_STATS_HANDLER_IDX, SPECTRAL_SCAN_GET_DIAG_STATS_HANDLER_IDX,
wlan_cfg80211_spectral_scan_get_diag_stats); wlan_cfg80211_spectral_scan_get_diag_stats);
wlan_cfg80211_register_spectral_cmd_handler( wlan_cfg80211_register_spectral_cmd_handler(
pdev, pdev,
SPECTRAL_SCAN_GET_CAP_HANDLER_IDX, SPECTRAL_SCAN_GET_CAP_HANDLER_IDX,
wlan_cfg80211_spectral_scan_get_cap); wlan_cfg80211_spectral_scan_get_cap);
wlan_cfg80211_register_spectral_cmd_handler( wlan_cfg80211_register_spectral_cmd_handler(
pdev, pdev,
SPECTRAL_SCAN_GET_STATUS_HANDLER_IDX, SPECTRAL_SCAN_GET_STATUS_HANDLER_IDX,
wlan_cfg80211_spectral_scan_get_status); wlan_cfg80211_spectral_scan_get_status);
} }
#else #else
static void spectral_register_cfg80211_handlers(struct wlan_objmgr_pdev *pdev) static void
spectral_register_cfg80211_handlers(struct wlan_objmgr_pdev *pdev)
{ {
} }
#endif #endif
int spectral_control_cmn( int
struct wlan_objmgr_pdev *pdev, spectral_control_cmn(struct wlan_objmgr_pdev *pdev,
u_int id, u_int id,
void *indata, void *indata,
u_int32_t insize, uint32_t insize, void *outdata, uint32_t *outsize)
void *outdata, u_int32_t *outsize)
{ {
int error = 0; int error = 0;
int temp_debug; int temp_debug;
@@ -115,7 +125,7 @@ int spectral_control_cmn(
struct spectral_config *spectralparams; struct spectral_config *spectralparams;
struct spectral_context *sc; struct spectral_context *sc;
struct wlan_objmgr_vdev *vdev = NULL; struct wlan_objmgr_vdev *vdev = NULL;
u_int8_t vdev_rxchainmask = 0; uint8_t vdev_rxchainmask = 0;
if (!pdev) { if (!pdev) {
spectral_err("PDEV is NULL!\n"); spectral_err("PDEV is NULL!\n");
@@ -131,353 +141,387 @@ int spectral_control_cmn(
switch (id) { switch (id) {
case SPECTRAL_SET_CONFIG: case SPECTRAL_SET_CONFIG:
{ {
if (insize < sizeof(struct spectral_config) || !indata) { if (insize < sizeof(struct spectral_config) ||
error = -EINVAL; !indata) {
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");
error = -EINVAL; error = -EINVAL;
break; break;
} else if (!sc->sptrlc_set_spectral_config(pdev, }
SPECTRAL_PARAM_CHN_MASK, sp_in->ss_chn_mask)) { sp_in = (struct spectral_config *)indata;
error = -EINVAL; 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: case SPECTRAL_GET_CONFIG:
{ {
if (!outdata || !outsize || (*outsize < sizeof( if (!outdata || !outsize ||
struct spectral_config))) { (*outsize < sizeof(struct spectral_config))) {
error = -EINVAL; error = -EINVAL;
break; 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); break;
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;
case SPECTRAL_IS_ACTIVE: case SPECTRAL_IS_ACTIVE:
{ {
if (!outdata || !outsize || *outsize < sizeof(u_int32_t)) { if (!outdata || !outsize ||
error = -EINVAL; *outsize < sizeof(uint32_t)) {
break; error = -EINVAL;
break;
}
*outsize = sizeof(uint32_t);
*((uint32_t *)outdata) =
(uint32_t)sc->sptrlc_is_spectral_active(pdev);
} }
*outsize = sizeof(u_int32_t); break;
*((u_int32_t *)outdata) =
(u_int32_t)sc->sptrlc_is_spectral_active(pdev);
}
break;
case SPECTRAL_IS_ENABLED: case SPECTRAL_IS_ENABLED:
{ {
if (!outdata || !outsize || *outsize < sizeof(u_int32_t)) { if (!outdata || !outsize ||
error = -EINVAL; *outsize < sizeof(uint32_t)) {
break; error = -EINVAL;
break;
}
*outsize = sizeof(uint32_t);
*((uint32_t *)outdata) =
(uint32_t)sc->sptrlc_is_spectral_enabled(pdev);
} }
*outsize = sizeof(u_int32_t); break;
*((u_int32_t *)outdata) =
(u_int32_t)sc->sptrlc_is_spectral_enabled(pdev);
}
break;
case SPECTRAL_SET_DEBUG_LEVEL: case SPECTRAL_SET_DEBUG_LEVEL:
{ {
if (insize < sizeof(u_int32_t) || !indata) { if (insize < sizeof(uint32_t) || !indata) {
error = -EINVAL; error = -EINVAL;
break; break;
}
temp_debug = *(uint32_t *)indata;
sc->sptrlc_set_debug_level(pdev, temp_debug);
} }
temp_debug = *(u_int32_t *)indata; break;
sc->sptrlc_set_debug_level(pdev, temp_debug);
}
break;
case SPECTRAL_GET_DEBUG_LEVEL: case SPECTRAL_GET_DEBUG_LEVEL:
{ {
if (!outdata || !outsize || *outsize < sizeof(u_int32_t)) { if (!outdata || !outsize ||
error = -EINVAL; *outsize < sizeof(uint32_t)) {
break; error = -EINVAL;
break;
}
*outsize = sizeof(uint32_t);
*((uint32_t *)outdata) =
(uint32_t)sc->sptrlc_get_debug_level(pdev);
} }
*outsize = sizeof(u_int32_t); break;
*((u_int32_t *)outdata) =
(u_int32_t)sc->sptrlc_get_debug_level(pdev);
}
break;
case SPECTRAL_ACTIVATE_SCAN: case SPECTRAL_ACTIVATE_SCAN:
{ {
sc->sptrlc_start_spectral_scan(pdev); sc->sptrlc_start_spectral_scan(pdev);
} }
break; break;
case SPECTRAL_STOP_SCAN: case SPECTRAL_STOP_SCAN:
{ {
sc->sptrlc_stop_spectral_scan(pdev); sc->sptrlc_stop_spectral_scan(pdev);
} }
break; break;
case SPECTRAL_GET_CAPABILITY_INFO: case SPECTRAL_GET_CAPABILITY_INFO:
{ {
if (!outdata || !outsize || if (!outdata || !outsize ||
*outsize < sizeof(struct spectral_caps)) { *outsize < sizeof(struct spectral_caps)) {
error = -EINVAL; error = -EINVAL;
break; break;
}
*outsize = sizeof(struct spectral_caps);
sc->sptrlc_get_spectral_capinfo(pdev, outdata);
} }
*outsize = sizeof(struct spectral_caps); break;
sc->sptrlc_get_spectral_capinfo(pdev, outdata);
}
break;
case SPECTRAL_GET_DIAG_STATS: case SPECTRAL_GET_DIAG_STATS:
{ {
if (!outdata || !outsize || if (!outdata || !outsize ||
(*outsize < sizeof(struct spectral_diag_stats))) { (*outsize < sizeof(struct spectral_diag_stats))) {
error = -EINVAL; error = -EINVAL;
break; break;
}
*outsize = sizeof(struct spectral_diag_stats);
sc->sptrlc_get_spectral_diagstats(pdev, outdata);
} }
*outsize = sizeof(struct spectral_diag_stats); break;
sc->sptrlc_get_spectral_diagstats(pdev, outdata);
}
break;
case SPECTRAL_GET_CHAN_WIDTH: case SPECTRAL_GET_CHAN_WIDTH:
{ {
u_int32_t chan_width; uint32_t chan_width;
vdev = spectral_get_vdev(pdev); vdev = spectral_get_vdev(pdev);
if (!vdev) if (!vdev)
return -ENOENT; return -ENOENT;
chan_width = spectral_vdev_get_ch_width(vdev); chan_width = spectral_vdev_get_ch_width(vdev);
wlan_objmgr_vdev_release_ref(vdev, WLAN_SPECTRAL_ID); wlan_objmgr_vdev_release_ref(vdev, WLAN_SPECTRAL_ID);
if (!outdata || !outsize || if (!outdata || !outsize ||
*outsize < sizeof(chan_width)) { *outsize < sizeof(chan_width)) {
error = -EINVAL; error = -EINVAL;
break; break;
}
*outsize = sizeof(chan_width);
*((uint32_t *)outdata) = (uint32_t)chan_width;
} }
*outsize = sizeof(chan_width); break;
*((u_int32_t *)outdata) = (u_int32_t)chan_width;
}
break;
default: default:
error = -EINVAL; error = -EINVAL;
break; break;
} }
bad: bad:
return error; 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) { if (sc) {
sc->sptrlc_ucfg_phyerr_config = NULL; sc->sptrlc_ucfg_phyerr_config = NULL;
sc->sptrlc_pdev_spectral_init = NULL; sc->sptrlc_pdev_spectral_init = NULL;
sc->sptrlc_pdev_spectral_deinit = NULL; sc->sptrlc_pdev_spectral_deinit = NULL;
sc->sptrlc_set_spectral_config = NULL; sc->sptrlc_set_spectral_config = NULL;
sc->sptrlc_get_spectral_config = NULL; sc->sptrlc_get_spectral_config = NULL;
sc->sptrlc_start_spectral_scan = NULL; sc->sptrlc_start_spectral_scan = NULL;
sc->sptrlc_stop_spectral_scan = NULL; sc->sptrlc_stop_spectral_scan = NULL;
sc->sptrlc_is_spectral_active = NULL; sc->sptrlc_is_spectral_active = NULL;
sc->sptrlc_is_spectral_enabled = NULL; sc->sptrlc_is_spectral_enabled = NULL;
sc->sptrlc_set_debug_level = NULL; sc->sptrlc_set_debug_level = NULL;
sc->sptrlc_get_debug_level = NULL; sc->sptrlc_get_debug_level = NULL;
sc->sptrlc_get_spectral_capinfo = NULL; sc->sptrlc_get_spectral_capinfo = NULL;
sc->sptrlc_get_spectral_diagstats = 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"); spectral_err("PSOC is NULL\n");
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
sc = (struct spectral_context *)qdf_mem_malloc( sc = (struct spectral_context *)
sizeof(struct spectral_context)); qdf_mem_malloc(sizeof(struct spectral_context));
if (!sc) { if (!sc) {
spectral_err("Failed to allocate spectral_ctx object\n"); spectral_err("Failed to allocate spectral_ctx object\n");
return QDF_STATUS_E_NOMEM; 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; return QDF_STATUS_SUCCESS;
} }
QDF_STATUS wlan_spectral_psoc_obj_destroy_handler( QDF_STATUS
struct wlan_objmgr_psoc *psoc, wlan_spectral_psoc_obj_destroy_handler(struct wlan_objmgr_psoc *psoc,
void *arg) void *arg)
{ {
struct spectral_context *sc = NULL; struct spectral_context *sc = NULL;
@@ -521,13 +565,11 @@ QDF_STATUS wlan_spectral_psoc_obj_destroy_handler(
spectral_err("PSOC is NULL\n"); spectral_err("PSOC is NULL\n");
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
sc = wlan_objmgr_psoc_get_comp_private_obj( sc = wlan_objmgr_psoc_get_comp_private_obj(psoc,
psoc, WLAN_UMAC_COMP_SPECTRAL);
WLAN_UMAC_COMP_SPECTRAL);
if (sc) { if (sc) {
wlan_objmgr_psoc_component_obj_detach( wlan_objmgr_psoc_component_obj_detach(psoc,
psoc, WLAN_UMAC_COMP_SPECTRAL,
WLAN_UMAC_COMP_SPECTRAL,
(void *)sc); (void *)sc);
/* Deinitilise function pointers from spectral context */ /* Deinitilise function pointers from spectral context */
spectral_ctx_deinit(sc); 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"); spectral_err("PDEV is NULL\n");
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
ps = (struct pdev_spectral *)qdf_mem_malloc( ps = (struct pdev_spectral *)
sizeof(struct pdev_spectral)); qdf_mem_malloc(sizeof(struct pdev_spectral));
if (!ps) { if (!ps) {
spectral_err("Failed to allocate pdev_spectral object\n"); spectral_err("Failed to allocate pdev_spectral object\n");
return QDF_STATUS_E_NOMEM; 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); (void *)ps, QDF_STATUS_SUCCESS);
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
cleanup: cleanup:
qdf_mem_free(ps); qdf_mem_free(ps);
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
QDF_STATUS 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 pdev_spectral *ps = NULL;
struct spectral_context *sc = 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"); spectral_err("Spectral context is NULL!\n");
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
ps = wlan_objmgr_pdev_get_comp_private_obj( ps = wlan_objmgr_pdev_get_comp_private_obj(pdev,
pdev, WLAN_UMAC_COMP_SPECTRAL);
WLAN_UMAC_COMP_SPECTRAL);
if (ps) { if (ps) {
if (sc->sptrlc_pdev_spectral_deinit) if (sc->sptrlc_pdev_spectral_deinit)
sc->sptrlc_pdev_spectral_deinit(pdev); sc->sptrlc_pdev_spectral_deinit(pdev);
ps->psptrl_target_handle = NULL; ps->psptrl_target_handle = NULL;
wlan_objmgr_pdev_component_obj_detach( wlan_objmgr_pdev_component_obj_detach(pdev,
pdev, WLAN_UMAC_COMP_SPECTRAL,
WLAN_UMAC_COMP_SPECTRAL,
(void *)ps); (void *)ps);
qdf_mem_free(ps); qdf_mem_free(ps);
} }
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017 The Linux Foundation. All rights reserved. * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
* *
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
@@ -23,11 +23,14 @@
#include "spectral_defs_i.h" #include "spectral_defs_i.h"
/** /**
* spectral_ctx_init_da() - Internal function to initialise spectral context * spectral_ctx_init_da() - Internal function to initialize spectral context
* with direct attach specific functions * with direct attach specific functions
* @sc : spectral context * @sc : spectral context
* *
* Return : void * Internal function to initialize spectral context with direct attach
* specific functions
*
* Return : None
*/ */
void spectral_ctx_init_da(struct spectral_context *sc); void spectral_ctx_init_da(struct spectral_context *sc);

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017 The Linux Foundation. All rights reserved. * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
* *
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
@@ -60,16 +60,16 @@ QDF_PRINT_INFO(QDF_PRINT_IDX_SHARED, QDF_MODULE_ID_SPECTRAL, level, ## args)
* @psptrl_target_handle: reference to spectral lmac object * @psptrl_target_handle: reference to spectral lmac object
*/ */
struct pdev_spectral { struct pdev_spectral {
struct wlan_objmgr_pdev *psptrl_pdev; struct wlan_objmgr_pdev *psptrl_pdev;
struct sock *psptrl_nl_sock; struct sock *psptrl_nl_sock;
void *psptrl_target_handle; void *psptrl_target_handle;
}; };
struct wmi_spectral_cmd_ops; struct wmi_spectral_cmd_ops;
/** /**
* struct spectral_context : spectral global context * struct spectral_context - spectral global context
* * @psoc_obj: Reference to psoc global object
* @psoc_obj: Reference to psoc global object * @spectral_legacy_cbacks: Spectral legacy callbacks
* *
* Call back functions to invoke independent of OL/DA * Call back functions to invoke independent of OL/DA
* @sptrlc_ucfg_phyerr_config: ucfg handler for phyerr * @sptrlc_ucfg_phyerr_config: ucfg handler for phyerr
@@ -85,38 +85,39 @@ struct wmi_spectral_cmd_ops;
* @sptrlc_get_debug_level: Get debug level * @sptrlc_get_debug_level: Get debug level
* @sptrlc_get_spectral_capinfo: Get spectral capability info * @sptrlc_get_spectral_capinfo: Get spectral capability info
* @sptrlc_get_spectral_diagstats: Get spectral diag status * @sptrlc_get_spectral_diagstats: Get spectral diag status
* @sptrlc_register_wmi_spectral_cmd_ops: Register wmi_spectral_cmd operations
*/ */
struct spectral_context { struct spectral_context {
struct wlan_objmgr_psoc *psoc_obj; struct wlan_objmgr_psoc *psoc_obj;
struct spectral_legacy_cbacks legacy_cbacks; struct spectral_legacy_cbacks legacy_cbacks;
int (*sptrlc_spectral_control)(struct wlan_objmgr_pdev *pdev, u_int id, int (*sptrlc_spectral_control)(struct wlan_objmgr_pdev *pdev,
void *indata, u_int32_t insize, u_int id, void *indata,
void *outdata, u_int32_t *outsize); uint32_t insize, void *outdata,
uint32_t *outsize);
int (*sptrlc_ucfg_phyerr_config)(struct wlan_objmgr_pdev *pdev, int (*sptrlc_ucfg_phyerr_config)(struct wlan_objmgr_pdev *pdev,
void *ad); void *ad);
void * (*sptrlc_pdev_spectral_init)(struct wlan_objmgr_pdev *pdev); void * (*sptrlc_pdev_spectral_init)(struct wlan_objmgr_pdev *pdev);
void (*sptrlc_pdev_spectral_deinit)(struct wlan_objmgr_pdev *pdev); void (*sptrlc_pdev_spectral_deinit)(struct wlan_objmgr_pdev *pdev);
int (*sptrlc_set_spectral_config)( int (*sptrlc_set_spectral_config)(struct wlan_objmgr_pdev *pdev,
struct wlan_objmgr_pdev *pdev, const uint32_t threshtype,
const u_int32_t threshtype, const u_int32_t value); const uint32_t value);
void (*sptrlc_get_spectral_config)( void (*sptrlc_get_spectral_config)(
struct wlan_objmgr_pdev *pdev, struct wlan_objmgr_pdev *pdev,
struct spectral_config *sptrl_config); struct spectral_config *sptrl_config);
int (*sptrlc_start_spectral_scan)(struct wlan_objmgr_pdev *pdev); int (*sptrlc_start_spectral_scan)(struct wlan_objmgr_pdev *pdev);
void (*sptrlc_stop_spectral_scan)(struct wlan_objmgr_pdev *pdev); void (*sptrlc_stop_spectral_scan)(struct wlan_objmgr_pdev *pdev);
bool (*sptrlc_is_spectral_active)(struct wlan_objmgr_pdev *pdev); bool (*sptrlc_is_spectral_active)(struct wlan_objmgr_pdev *pdev);
bool (*sptrlc_is_spectral_enabled)(struct wlan_objmgr_pdev *pdev); bool (*sptrlc_is_spectral_enabled)(struct wlan_objmgr_pdev *pdev);
int (*sptrlc_set_debug_level)(struct wlan_objmgr_pdev *pdev, int (*sptrlc_set_debug_level)(struct wlan_objmgr_pdev *pdev,
u_int32_t debug_level); uint32_t debug_level);
u_int32_t (*sptrlc_get_debug_level)(struct wlan_objmgr_pdev *pdev); uint32_t (*sptrlc_get_debug_level)(struct wlan_objmgr_pdev *pdev);
void (*sptrlc_get_spectral_capinfo)(struct wlan_objmgr_pdev *pdev, void (*sptrlc_get_spectral_capinfo)(struct wlan_objmgr_pdev *pdev,
void *outdata); void *outdata);
void (*sptrlc_get_spectral_diagstats)(struct wlan_objmgr_pdev *pdev, void (*sptrlc_get_spectral_diagstats)(struct wlan_objmgr_pdev *pdev,
void *outdata); void *outdata);
void (*sptrlc_register_wmi_spectral_cmd_ops)( void (*sptrlc_register_wmi_spectral_cmd_ops)(
struct wlan_objmgr_pdev *pdev, struct wlan_objmgr_pdev *pdev,
struct wmi_spectral_cmd_ops *cmd_ops); struct wmi_spectral_cmd_ops *cmd_ops);
}; };
#endif /* _SPECTRAL_DEFS_I_H_ */ #endif /* _SPECTRAL_DEFS_I_H_ */

View File

@@ -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 * Permission to use, copy, modify, and/or distribute this software for
@@ -19,8 +19,23 @@
#include "spectral_cmn_api_i.h" #include "spectral_cmn_api_i.h"
int spectral_control_da(struct wlan_objmgr_pdev *pdev, u_int id, void *indata, /**
u_int32_t insize, void *outdata, u_int32_t *outsize) * spectral_control_da()- handler for demultiplexing requests from higher layer
* @pdev: reference to global pdev object
* @id: spectral config command id
* @indata: reference to input data
* @insize: input data size
* @outdata: reference to output data
* @outsize: output data size
*
* This function processes the spectral config command
* and appropriate handlers are invoked.
*
* Return: 0 success else failure
*/
int
spectral_control_da(struct wlan_objmgr_pdev *pdev, u_int id, void *indata,
uint32_t insize, void *outdata, uint32_t *outsize)
{ {
struct spectral_context *sc; struct spectral_context *sc;
int error = 0; int error = 0;
@@ -34,32 +49,29 @@ int spectral_control_da(struct wlan_objmgr_pdev *pdev, u_int id, void *indata,
spectral_err("spectral context is NULL!\n"); spectral_err("spectral context is NULL!\n");
return -EPERM; return -EPERM;
} }
switch (id) {
#if ATH_SUPPORT_RAW_ADC_CAPTURE /*
case SPECTRAL_ADC_ENABLE_TEST_ADDAC_MODE: * Note: Add handling for the cases SPECTRAL_ADC_ENABLE_TEST_ADDAC_MODE
error = spectral_enter_raw_capture_mode(dev, indata); * SPECTRAL_ADC_DISABLE_TEST_ADDAC_MODE and SPECTRAL_ADC_RETRIEVE_DATA,
break; * when raw ADC capture is needed.
case SPECTRAL_ADC_DISABLE_TEST_ADDAC_MODE: * This is only applicable for direct attach chipsets.
error = spectral_exit_raw_capture_mode(dev); */
break; error = spectral_control_cmn(pdev,
case SPECTRAL_ADC_RETRIEVE_DATA: id,
error = spectral_retrieve_raw_capture(dev, outdata, outsize); indata, insize, outdata, outsize);
break;
#endif
default:
error = spectral_control_cmn(
pdev,
id,
indata,
insize,
outdata,
outsize);
break;
}
return error; return error;
} }
static void *pdev_spectral_init_da(struct wlan_objmgr_pdev *pdev) /**
* pdev_spectral_init_da() - offload implementation for spectral init
* @pdev: Pointer to pdev
*
* Return: On success, pointer to Spectral target_if internal private data, on
* failure, NULL
*/
static void *
pdev_spectral_init_da(struct wlan_objmgr_pdev *pdev)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
@@ -69,7 +81,14 @@ static void *pdev_spectral_init_da(struct wlan_objmgr_pdev *pdev)
pdev); pdev);
} }
static void pdev_spectral_deinit_da(struct wlan_objmgr_pdev *pdev) /**
* pdev_spectral_deinit_da() - offload implementation for spectral de-init
* @pdev: Pointer to pdev
*
* Return: None
*/
static void
pdev_spectral_deinit_da(struct wlan_objmgr_pdev *pdev)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
@@ -78,32 +97,61 @@ static void pdev_spectral_deinit_da(struct wlan_objmgr_pdev *pdev)
psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_pdev_spectral_deinit(pdev); psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_pdev_spectral_deinit(pdev);
} }
static int set_spectral_config_da( /**
struct wlan_objmgr_pdev *pdev, * set_spectral_config_da() - Set spectral config
const u_int32_t threshtype, const u_int32_t value) * @pdev: Pointer to pdev object
* @threshtype: spectral parameter type
* @value: value to be configured for the given spectral parameter
*
* DA implementation for setting spectral config
*
* Return: 0 on success else failure
*/
static int
set_spectral_config_da(struct wlan_objmgr_pdev *pdev,
const uint32_t threshtype, const uint32_t value)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
psoc = wlan_pdev_get_psoc(pdev); psoc = wlan_pdev_get_psoc(pdev);
return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_set_spectral_config( return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_set_spectral_config(
pdev, pdev, threshtype, value);
threshtype,
value);
} }
static void get_spectral_config_da(struct wlan_objmgr_pdev *pdev, /**
struct spectral_config *sptrl_config) * get_spectral_config_da() - Get spectral configuration
* @pdev: Pointer to pdev object
* @param: Pointer to spectral_config structure in which the configuration
* should be returned
*
* DA implementation for getting the current spectral configuration
*
* Return: None
*/
static void
get_spectral_config_da(struct wlan_objmgr_pdev *pdev,
struct spectral_config *sptrl_config)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
psoc = wlan_pdev_get_psoc(pdev); psoc = wlan_pdev_get_psoc(pdev);
psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_get_spectral_config(pdev, psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_get_spectral_config(
sptrl_config); pdev,
sptrl_config);
} }
static int start_spectral_scan_da(struct wlan_objmgr_pdev *pdev) /**
* start_spectral_scan_da() - Start spectral scan
* @pdev: Pointer to pdev object
*
* DA implementation for starting spectral scan
*
* Return: 0 in case of success, -1 on failure
*/
static int
start_spectral_scan_da(struct wlan_objmgr_pdev *pdev)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
@@ -113,7 +161,16 @@ static int start_spectral_scan_da(struct wlan_objmgr_pdev *pdev)
pdev); pdev);
} }
static void stop_spectral_scan_da(struct wlan_objmgr_pdev *pdev) /**
* stop_spectral_scan_da() - Stop spectral scan
* @pdev: Pointer to pdev object
*
* DA implementation for stop spectral scan
*
* Return: None
*/
static void
stop_spectral_scan_da(struct wlan_objmgr_pdev *pdev)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
@@ -122,7 +179,16 @@ static void stop_spectral_scan_da(struct wlan_objmgr_pdev *pdev)
psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_stop_spectral_scan(pdev); psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_stop_spectral_scan(pdev);
} }
static bool is_spectral_active_da(struct wlan_objmgr_pdev *pdev) /**
* is_spectral_active_da() - Get whether Spectral is active
* @pdev: Pointer to pdev object
*
* DA implementation to get whether Spectral is active
*
* Return: True if Spectral is active, false if Spectral is not active
*/
static bool
is_spectral_active_da(struct wlan_objmgr_pdev *pdev)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
@@ -132,7 +198,16 @@ static bool is_spectral_active_da(struct wlan_objmgr_pdev *pdev)
pdev); pdev);
} }
static bool is_spectral_enabled_da(struct wlan_objmgr_pdev *pdev) /**
* is_spectral_enabled_da() - Get whether Spectral is active
* @pdev: Pointer to pdev object
*
* DA implementation to get whether Spectral is active
*
* Return: True if Spectral is active, false if Spectral is not active
*/
static bool
is_spectral_enabled_da(struct wlan_objmgr_pdev *pdev)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
@@ -142,18 +217,37 @@ static bool is_spectral_enabled_da(struct wlan_objmgr_pdev *pdev)
pdev); pdev);
} }
static int set_debug_level_da(struct wlan_objmgr_pdev *pdev, /**
u_int32_t debug_level) * set_debug_level_da() - Set debug level for Spectral
* @pdev: Pointer to pdev object
* @debug_level: Debug level
*
* DA implementation to set the debug level for Spectral
*
* Return: 0 in case of success
*/
static int
set_debug_level_da(struct wlan_objmgr_pdev *pdev, uint32_t debug_level)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
psoc = wlan_pdev_get_psoc(pdev); psoc = wlan_pdev_get_psoc(pdev);
return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_set_debug_level(pdev, return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_set_debug_level(
pdev,
debug_level); debug_level);
} }
static u_int32_t get_debug_level_da(struct wlan_objmgr_pdev *pdev) /**
* get_debug_level_da() - Get debug level for Spectral
* @pdev: Pointer to pdev object
*
* DA implementation to get the debug level for Spectral
*
* Return: Current debug level
*/
static uint32_t
get_debug_level_da(struct wlan_objmgr_pdev *pdev)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
@@ -162,33 +256,59 @@ static u_int32_t get_debug_level_da(struct wlan_objmgr_pdev *pdev)
return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_get_debug_level(pdev); return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_get_debug_level(pdev);
} }
static void get_spectral_capinfo_da(struct wlan_objmgr_pdev *pdev, /**
void *outdata) * get_spectral_capinfo_da() - Get Spectral capability information
* @pdev: Pointer to pdev object
* @outdata: Buffer into which data should be copied
*
* DA implementation to get the spectral capability information
*
* Return: void
*/
static void
get_spectral_capinfo_da(struct wlan_objmgr_pdev *pdev, void *outdata)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
psoc = wlan_pdev_get_psoc(pdev); psoc = wlan_pdev_get_psoc(pdev);
return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_get_spectral_capinfo( return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_get_spectral_capinfo(
pdev, pdev, outdata);
outdata);
} }
static void get_spectral_diagstats_da(struct wlan_objmgr_pdev *pdev, /**
void *outdata) * get_spectral_diagstats_da() - Get Spectral diagnostic statistics
* @pdev: Pointer to pdev object
* @outdata: Buffer into which data should be copied
*
* DA implementation to get the spectral diagnostic statistics
*
* Return: void
*/
static void
get_spectral_diagstats_da(struct wlan_objmgr_pdev *pdev, void *outdata)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
psoc = wlan_pdev_get_psoc(pdev); psoc = wlan_pdev_get_psoc(pdev);
return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_get_spectral_diagstats( return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_get_spectral_diagstats(
pdev, pdev, outdata);
outdata);
} }
static void register_wmi_spectral_cmd_ops_da( /**
struct wlan_objmgr_pdev *pdev, * register_wmi_spectral_cmd_ops_da() - Register wmi_spectral_cmd_ops
struct wmi_spectral_cmd_ops *cmd_ops) * @cmd_ops: Pointer to the structure having wmi_spectral_cmd function pointers
* @pdev: Pointer to pdev object
*
* DA implementation to register wmi_spectral_cmd_ops in spectral
* internal data structure
*
* Return: void
*/
static void
register_wmi_spectral_cmd_ops_da(struct wlan_objmgr_pdev *pdev,
struct wmi_spectral_cmd_ops *cmd_ops)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
struct wlan_lmac_if_sptrl_tx_ops *psptrl_tx_ops = NULL; struct wlan_lmac_if_sptrl_tx_ops *psptrl_tx_ops = NULL;
@@ -197,32 +317,30 @@ static void register_wmi_spectral_cmd_ops_da(
psptrl_tx_ops = &psoc->soc_cb.tx_ops.sptrl_tx_ops; psptrl_tx_ops = &psoc->soc_cb.tx_ops.sptrl_tx_ops;
return psptrl_tx_ops->sptrlto_register_wmi_spectral_cmd_ops( return psptrl_tx_ops->sptrlto_register_wmi_spectral_cmd_ops(pdev,
pdev, cmd_ops);
cmd_ops);
} }
void
void spectral_ctx_init_da(struct spectral_context *sc) spectral_ctx_init_da(struct spectral_context *sc)
{ {
if (!sc) { if (!sc) {
spectral_err("spectral context is null!\n"); spectral_err("spectral context is null!\n");
return; return;
} }
sc->sptrlc_spectral_control = spectral_control_da; sc->sptrlc_spectral_control = spectral_control_da;
sc->sptrlc_pdev_spectral_init = pdev_spectral_init_da; sc->sptrlc_pdev_spectral_init = pdev_spectral_init_da;
sc->sptrlc_pdev_spectral_deinit = pdev_spectral_deinit_da; sc->sptrlc_pdev_spectral_deinit = pdev_spectral_deinit_da;
sc->sptrlc_set_spectral_config = set_spectral_config_da; sc->sptrlc_set_spectral_config = set_spectral_config_da;
sc->sptrlc_get_spectral_config = get_spectral_config_da; sc->sptrlc_get_spectral_config = get_spectral_config_da;
sc->sptrlc_start_spectral_scan = start_spectral_scan_da; sc->sptrlc_start_spectral_scan = start_spectral_scan_da;
sc->sptrlc_stop_spectral_scan = stop_spectral_scan_da; sc->sptrlc_stop_spectral_scan = stop_spectral_scan_da;
sc->sptrlc_is_spectral_active = is_spectral_active_da; sc->sptrlc_is_spectral_active = is_spectral_active_da;
sc->sptrlc_is_spectral_enabled = is_spectral_enabled_da; sc->sptrlc_is_spectral_enabled = is_spectral_enabled_da;
sc->sptrlc_set_debug_level = set_debug_level_da; sc->sptrlc_set_debug_level = set_debug_level_da;
sc->sptrlc_get_debug_level = get_debug_level_da; sc->sptrlc_get_debug_level = get_debug_level_da;
sc->sptrlc_get_spectral_capinfo = get_spectral_capinfo_da; sc->sptrlc_get_spectral_capinfo = get_spectral_capinfo_da;
sc->sptrlc_get_spectral_diagstats = get_spectral_diagstats_da; sc->sptrlc_get_spectral_diagstats = get_spectral_diagstats_da;
sc->sptrlc_register_wmi_spectral_cmd_ops = sc->sptrlc_register_wmi_spectral_cmd_ops =
register_wmi_spectral_cmd_ops_da; register_wmi_spectral_cmd_ops_da;
} }

View File

@@ -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 * Permission to use, copy, modify, and/or distribute this software for
@@ -34,9 +34,9 @@ spectral_init_module(void)
{ {
qdf_print("qca_spectral module loaded\n"); qdf_print("qca_spectral module loaded\n");
wlan_spectral_init(); wlan_spectral_init();
/* register spectral rxops*/ /* register spectral rxops */
wlan_lmac_if_sptrl_set_rx_ops_register_cb( wlan_lmac_if_sptrl_set_rx_ops_register_cb
wlan_lmac_if_sptrl_register_rx_ops); (wlan_lmac_if_sptrl_register_rx_ops);
return 0; return 0;
} }
@@ -54,4 +54,3 @@ spectral_exit_module(void)
module_init(spectral_init_module); module_init(spectral_init_module);
module_exit(spectral_exit_module); module_exit(spectral_exit_module);

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017 The Linux Foundation. All rights reserved. * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
* *
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
@@ -20,12 +20,25 @@
#include "spectral_cmn_api_i.h" #include "spectral_cmn_api_i.h"
#include "spectral_ol_api_i.h" #include "spectral_ol_api_i.h"
int spectral_control_ol( /**
struct wlan_objmgr_pdev *pdev, * spectral_control_ol()- handler for demultiplexing requests from higher layer
u_int id, * @pdev: reference to global pdev object
void *indata, * @id: spectral config command id
u_int32_t insize, * @indata: reference to input data
void *outdata, u_int32_t *outsize) * @insize: input data size
* @outdata: reference to output data
* @outsize: output data size
*
* This function processes the spectral config command
* and appropriate handlers are invoked.
*
* Return: 0 success else failure
*/
int
spectral_control_ol(struct wlan_objmgr_pdev *pdev,
u_int id,
void *indata,
uint32_t insize, void *outdata, uint32_t *outsize)
{ {
struct spectral_context *sc; struct spectral_context *sc;
@@ -41,7 +54,15 @@ int spectral_control_ol(
return spectral_control_cmn(pdev, id, indata, insize, outdata, outsize); return spectral_control_cmn(pdev, id, indata, insize, outdata, outsize);
} }
static void *pdev_spectral_init_ol(struct wlan_objmgr_pdev *pdev) /**
* pdev_spectral_init_ol() - offload implementation for spectral init
* @pdev: Pointer to pdev
*
* Return: On success, pointer to Spectral target_if internal private data, on
* failure, NULL
*/
static void *
pdev_spectral_init_ol(struct wlan_objmgr_pdev *pdev)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
@@ -50,7 +71,14 @@ static void *pdev_spectral_init_ol(struct wlan_objmgr_pdev *pdev)
pdev); pdev);
} }
static void pdev_spectral_deinit_ol(struct wlan_objmgr_pdev *pdev) /**
* pdev_spectral_deinit_ol() - offload implementation for spectral de-init
* @pdev: Pointer to pdev
*
* Return: None
*/
static void
pdev_spectral_deinit_ol(struct wlan_objmgr_pdev *pdev)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
@@ -58,29 +86,59 @@ static void pdev_spectral_deinit_ol(struct wlan_objmgr_pdev *pdev)
psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_pdev_spectral_deinit(pdev); psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_pdev_spectral_deinit(pdev);
} }
static int set_spectral_config_ol( /**
struct wlan_objmgr_pdev *pdev, * set_spectral_config_ol() - Set spectral config
const u_int32_t threshtype, const u_int32_t value) * @pdev: Pointer to pdev object
* @threshtype: spectral parameter type
* @value: value to be configured for the given spectral parameter
*
* Offload implementation for setting spectral config
*
* Return: 0 on success else failure
*/
static int
set_spectral_config_ol(struct wlan_objmgr_pdev *pdev,
const uint32_t threshtype, const uint32_t value)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
psoc = wlan_pdev_get_psoc(pdev); psoc = wlan_pdev_get_psoc(pdev);
return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_set_spectral_config( return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_set_spectral_config(
pdev, pdev, threshtype, value);
threshtype, value);
} }
static void get_spectral_config_ol(struct wlan_objmgr_pdev *pdev, /**
struct spectral_config *sptrl_config) * get_spectral_config_ol() - Get spectral configuration
* @pdev: Pointer to pdev object
* @param: Pointer to spectral_config structure in which the configuration
* should be returned
*
* Offload implementation for getting the current spectral configuration
*
* Return: None
*/
static void
get_spectral_config_ol(struct wlan_objmgr_pdev *pdev,
struct spectral_config *sptrl_config)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
psoc = wlan_pdev_get_psoc(pdev); psoc = wlan_pdev_get_psoc(pdev);
psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_get_spectral_config(pdev, psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_get_spectral_config(
pdev,
sptrl_config); sptrl_config);
} }
static int start_spectral_scan_ol(struct wlan_objmgr_pdev *pdev) /**
* start_spectral_scan_ol() - Start spectral scan
* @pdev: Pointer to pdev object
*
* Offload implementation for starting spectral scan
*
* Return: 0 in case of success, -1 on failure
*/
static int
start_spectral_scan_ol(struct wlan_objmgr_pdev *pdev)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
@@ -89,7 +147,16 @@ static int start_spectral_scan_ol(struct wlan_objmgr_pdev *pdev)
pdev); pdev);
} }
static void stop_spectral_scan_ol(struct wlan_objmgr_pdev *pdev) /**
* stop_spectral_scan_ol() - Stop spectral scan
* @pdev: Pointer to pdev object
*
* Offload implementation for stop spectral scan
*
* Return: None
*/
static void
stop_spectral_scan_ol(struct wlan_objmgr_pdev *pdev)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
@@ -97,7 +164,16 @@ static void stop_spectral_scan_ol(struct wlan_objmgr_pdev *pdev)
psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_stop_spectral_scan(pdev); psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_stop_spectral_scan(pdev);
} }
static bool is_spectral_active_ol(struct wlan_objmgr_pdev *pdev) /**
* is_spectral_active_ol() - Get whether Spectral is active
* @pdev: Pointer to pdev object
*
* Offload implementation to get whether Spectral is active
*
* Return: True if Spectral is active, false if Spectral is not active
*/
static bool
is_spectral_active_ol(struct wlan_objmgr_pdev *pdev)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
@@ -106,7 +182,16 @@ static bool is_spectral_active_ol(struct wlan_objmgr_pdev *pdev)
pdev); pdev);
} }
static bool is_spectral_enabled_ol(struct wlan_objmgr_pdev *pdev) /**
* is_spectral_enabled_ol() - Get whether Spectral is active
* @pdev: Pointer to pdev object
*
* Offload implementation to get whether Spectral is active
*
* Return: True if Spectral is active, false if Spectral is not active
*/
static bool
is_spectral_enabled_ol(struct wlan_objmgr_pdev *pdev)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
@@ -115,17 +200,36 @@ static bool is_spectral_enabled_ol(struct wlan_objmgr_pdev *pdev)
pdev); pdev);
} }
static int set_debug_level_ol(struct wlan_objmgr_pdev *pdev, /**
u_int32_t debug_level) * set_debug_level_ol() - Set debug level for Spectral
* @pdev: Pointer to pdev object
* @debug_level: Debug level
*
* Offload implementation to set the debug level for Spectral
*
* Return: 0 in case of success
*/
static int
set_debug_level_ol(struct wlan_objmgr_pdev *pdev, uint32_t debug_level)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
psoc = wlan_pdev_get_psoc(pdev); psoc = wlan_pdev_get_psoc(pdev);
return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_set_debug_level(pdev, return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_set_debug_level(
pdev,
debug_level); debug_level);
} }
static u_int32_t get_debug_level_ol(struct wlan_objmgr_pdev *pdev) /**
* get_debug_level_ol() - Get debug level for Spectral
* @pdev: Pointer to pdev object
*
* Offload implementation to get the debug level for Spectral
*
* Return: Current debug level
*/
static uint32_t
get_debug_level_ol(struct wlan_objmgr_pdev *pdev)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
@@ -133,31 +237,57 @@ static u_int32_t get_debug_level_ol(struct wlan_objmgr_pdev *pdev)
return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_get_debug_level(pdev); return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_get_debug_level(pdev);
} }
static void get_spectral_capinfo_ol(struct wlan_objmgr_pdev *pdev, /**
void *outdata) * get_spectral_capinfo_ol() - Get Spectral capability information
* @pdev: Pointer to pdev object
* @outdata: Buffer into which data should be copied
*
* Offload implementation to get the spectral capability information
*
* Return: void
*/
static void
get_spectral_capinfo_ol(struct wlan_objmgr_pdev *pdev, void *outdata)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
psoc = wlan_pdev_get_psoc(pdev); psoc = wlan_pdev_get_psoc(pdev);
return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_get_spectral_capinfo( return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_get_spectral_capinfo(
pdev, pdev, outdata);
outdata);
} }
static void get_spectral_diagstats_ol(struct wlan_objmgr_pdev *pdev, /**
void *outdata) * get_spectral_diagstats_ol() - Get Spectral diagnostic statistics
* @pdev: Pointer to pdev object
* @outdata: Buffer into which data should be copied
*
* Offload implementation to get the spectral diagnostic statistics
*
* Return: void
*/
static void
get_spectral_diagstats_ol(struct wlan_objmgr_pdev *pdev, void *outdata)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
psoc = wlan_pdev_get_psoc(pdev); psoc = wlan_pdev_get_psoc(pdev);
return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_get_spectral_diagstats( return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_get_spectral_diagstats(
pdev, pdev, outdata);
outdata);
} }
static void register_wmi_spectral_cmd_ops_ol( /**
struct wlan_objmgr_pdev *pdev, * register_wmi_spectral_cmd_ops_ol() - Register wmi_spectral_cmd_ops
struct wmi_spectral_cmd_ops *cmd_ops) * @cmd_ops: Pointer to the structure having wmi_spectral_cmd function pointers
* @pdev: Pointer to pdev object
*
* Offload implementation to register wmi_spectral_cmd_ops in spectral
* internal data structure
*
* Return: void
*/
static void
register_wmi_spectral_cmd_ops_ol(struct wlan_objmgr_pdev *pdev,
struct wmi_spectral_cmd_ops *cmd_ops)
{ {
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
struct wlan_lmac_if_sptrl_tx_ops *psptrl_tx_ops = NULL; struct wlan_lmac_if_sptrl_tx_ops *psptrl_tx_ops = NULL;
@@ -166,31 +296,30 @@ static void register_wmi_spectral_cmd_ops_ol(
psptrl_tx_ops = &psoc->soc_cb.tx_ops.sptrl_tx_ops; psptrl_tx_ops = &psoc->soc_cb.tx_ops.sptrl_tx_ops;
return psptrl_tx_ops->sptrlto_register_wmi_spectral_cmd_ops( return psptrl_tx_ops->sptrlto_register_wmi_spectral_cmd_ops(pdev,
pdev, cmd_ops);
cmd_ops);
} }
void spectral_ctx_init_ol(struct spectral_context *sc) void
spectral_ctx_init_ol(struct spectral_context *sc)
{ {
if (!sc) { if (!sc) {
spectral_err("spectral context is null!\n"); spectral_err("spectral context is null!\n");
return; return;
} }
sc->sptrlc_spectral_control = spectral_control_ol; sc->sptrlc_spectral_control = spectral_control_ol;
sc->sptrlc_pdev_spectral_init = pdev_spectral_init_ol; sc->sptrlc_pdev_spectral_init = pdev_spectral_init_ol;
sc->sptrlc_pdev_spectral_deinit = pdev_spectral_deinit_ol; sc->sptrlc_pdev_spectral_deinit = pdev_spectral_deinit_ol;
sc->sptrlc_set_spectral_config = set_spectral_config_ol; sc->sptrlc_set_spectral_config = set_spectral_config_ol;
sc->sptrlc_get_spectral_config = get_spectral_config_ol; sc->sptrlc_get_spectral_config = get_spectral_config_ol;
sc->sptrlc_start_spectral_scan = start_spectral_scan_ol; sc->sptrlc_start_spectral_scan = start_spectral_scan_ol;
sc->sptrlc_stop_spectral_scan = stop_spectral_scan_ol; sc->sptrlc_stop_spectral_scan = stop_spectral_scan_ol;
sc->sptrlc_is_spectral_active = is_spectral_active_ol; sc->sptrlc_is_spectral_active = is_spectral_active_ol;
sc->sptrlc_is_spectral_enabled = is_spectral_enabled_ol; sc->sptrlc_is_spectral_enabled = is_spectral_enabled_ol;
sc->sptrlc_set_debug_level = set_debug_level_ol; sc->sptrlc_set_debug_level = set_debug_level_ol;
sc->sptrlc_get_debug_level = get_debug_level_ol; sc->sptrlc_get_debug_level = get_debug_level_ol;
sc->sptrlc_get_spectral_capinfo = get_spectral_capinfo_ol; sc->sptrlc_get_spectral_capinfo = get_spectral_capinfo_ol;
sc->sptrlc_get_spectral_diagstats = get_spectral_diagstats_ol; sc->sptrlc_get_spectral_diagstats = get_spectral_diagstats_ol;
sc->sptrlc_register_wmi_spectral_cmd_ops = sc->sptrlc_register_wmi_spectral_cmd_ops =
register_wmi_spectral_cmd_ops_ol; register_wmi_spectral_cmd_ops_ol;
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017 The Linux Foundation. All rights reserved. * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
* *
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
@@ -23,11 +23,14 @@
#include "spectral_defs_i.h" #include "spectral_defs_i.h"
/** /**
* spectral_ctx_init_ol() - Internal function to initialise spectral context * spectral_ctx_init_ol() - Internal function to initialize spectral context
* with offload specific functions * with offload specific functions
* @sc : spectral context * @sc : spectral context
* *
* Return : void * Internal function to initialize spectral context with offload specific
* functions
*
* Return : None
*/ */
void spectral_ctx_init_ol(struct spectral_context *sc); void spectral_ctx_init_ol(struct spectral_context *sc);