diff --git a/spectral/core/spectral_common.c b/spectral/core/spectral_common.c index de30217aac..ea78c3166b 100644 --- a/spectral/core/spectral_common.c +++ b/spectral/core/spectral_common.c @@ -496,16 +496,21 @@ QDF_STATUS wlan_spectral_psoc_obj_create_handler(struct wlan_objmgr_psoc *psoc, void *arg) { struct spectral_context *sc = NULL; + QDF_STATUS status; if (!psoc) { spectral_err("PSOC is NULL"); return QDF_STATUS_E_FAILURE; } - if (cfg_get(psoc, CFG_SPECTRAL_DISABLE)) { - wlan_psoc_nif_feat_cap_set(psoc, - WLAN_SOC_F_SPECTRAL_INI_DISABLE); - spectral_info("Spectral is disabled"); + status = wlan_spectral_init_psoc_feature_cap(psoc); + if (QDF_IS_STATUS_ERROR(status)) { + spectral_err("Failed to intitialize spectral pdev feature caps"); + return QDF_STATUS_E_FAILURE; + } + + if (wlan_spectral_is_feature_disabled_psoc(psoc)) { + spectral_info("Spectral feature is disabled"); return QDF_STATUS_COMP_DISABLED; } @@ -535,8 +540,8 @@ wlan_spectral_psoc_obj_destroy_handler(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_E_FAILURE; } - if (wlan_spectral_is_feature_disabled(psoc)) { - spectral_info("Spectral is disabled"); + if (wlan_spectral_is_feature_disabled_psoc(psoc)) { + spectral_info("Spectral feature is disabled"); return QDF_STATUS_COMP_DISABLED; } @@ -560,14 +565,21 @@ wlan_spectral_pdev_obj_create_handler(struct wlan_objmgr_pdev *pdev, void *arg) struct pdev_spectral *ps = NULL; struct spectral_context *sc = NULL; void *target_handle = NULL; + QDF_STATUS status; if (!pdev) { spectral_err("PDEV is NULL"); return QDF_STATUS_E_FAILURE; } - if (wlan_spectral_is_feature_disabled(wlan_pdev_get_psoc(pdev))) { - spectral_info("Spectral is disabled"); + status = wlan_spectral_init_pdev_feature_caps(pdev); + if (QDF_IS_STATUS_ERROR(status)) { + spectral_err("Failed to intitialize spectral pdev feature caps"); + return QDF_STATUS_E_FAILURE; + } + + if (wlan_spectral_is_feature_disabled_pdev(pdev)) { + spectral_info("Spectral feature is disabled"); return QDF_STATUS_COMP_DISABLED; } @@ -615,8 +627,8 @@ wlan_spectral_pdev_obj_destroy_handler(struct wlan_objmgr_pdev *pdev, return QDF_STATUS_E_FAILURE; } - if (wlan_spectral_is_feature_disabled(wlan_pdev_get_psoc(pdev))) { - spectral_info("Spectral is disabled"); + if (wlan_spectral_is_feature_disabled_pdev(pdev)) { + spectral_info("Spectral feature is disabled"); return QDF_STATUS_COMP_DISABLED; } diff --git a/spectral/dispatcher/src/wlan_spectral_ucfg_api.c b/spectral/dispatcher/src/wlan_spectral_ucfg_api.c index f67c3cb162..6a2508c40c 100644 --- a/spectral/dispatcher/src/wlan_spectral_ucfg_api.c +++ b/spectral/dispatcher/src/wlan_spectral_ucfg_api.c @@ -23,6 +23,37 @@ #include #include +static bool +ucfg_spectral_is_mode_specific_request(uint8_t spectral_cp_request_id) +{ + bool mode_specific_request; + + switch (spectral_cp_request_id) { + case SPECTRAL_SET_CONFIG: + case SPECTRAL_GET_CONFIG: + case SPECTRAL_IS_ACTIVE: + case SPECTRAL_IS_ENABLED: + case SPECTRAL_ACTIVATE_SCAN: + case SPECTRAL_STOP_SCAN: + mode_specific_request = true; + break; + case SPECTRAL_SET_DEBUG_LEVEL: + case SPECTRAL_GET_DEBUG_LEVEL: + case SPECTRAL_GET_CAPABILITY_INFO: + case SPECTRAL_GET_DIAG_STATS: + case SPECTRAL_GET_CHAN_WIDTH: + case SPECTRAL_SET_DMA_DEBUG: + mode_specific_request = false; + break; + default: + spectral_err("Invalid spectral cp request id %u", + spectral_cp_request_id); + mode_specific_request = false; + } + + return mode_specific_request; +} + QDF_STATUS ucfg_spectral_control(struct wlan_objmgr_pdev *pdev, struct spectral_cp_request *sscan_req) @@ -34,11 +65,21 @@ ucfg_spectral_control(struct wlan_objmgr_pdev *pdev, return -EPERM; } - if (wlan_spectral_is_feature_disabled(wlan_pdev_get_psoc(pdev))) { - spectral_info("Spectral is disabled"); + if (wlan_spectral_is_feature_disabled_pdev(pdev)) { + spectral_info("Spectral feature is disabled"); return -EPERM; } + /* For mode specific requests, check whether + * Spectral mode in the cp request is disabaled + */ + if (ucfg_spectral_is_mode_specific_request(sscan_req->req_id) && + wlan_spectral_is_mode_disabled_pdev(pdev, sscan_req->ss_mode)) { + spectral_info("Spectral mode %d is disabled", + sscan_req->ss_mode); + return -ENOTSUPP; + } + sc = spectral_get_spectral_ctx_from_pdev(pdev); if (!sc) { spectral_err("spectral context is NULL!"); diff --git a/spectral/dispatcher/src/wlan_spectral_utils_api.c b/spectral/dispatcher/src/wlan_spectral_utils_api.c index 861a600937..362b4f3685 100644 --- a/spectral/dispatcher/src/wlan_spectral_utils_api.c +++ b/spectral/dispatcher/src/wlan_spectral_utils_api.c @@ -461,8 +461,8 @@ QDF_STATUS spectral_pdev_open(struct wlan_objmgr_pdev *pdev) psoc = wlan_pdev_get_psoc(pdev); - if (wlan_spectral_is_feature_disabled(psoc)) { - spectral_info("Spectral is disabled"); + if (wlan_spectral_is_feature_disabled_pdev(pdev)) { + spectral_err("Spectral feature is disabled"); return QDF_STATUS_COMP_DISABLED; } @@ -498,8 +498,8 @@ QDF_STATUS wlan_spectral_psoc_open(struct wlan_objmgr_psoc *psoc) return QDF_STATUS_E_INVAL; } - if (wlan_spectral_is_feature_disabled(psoc)) { - spectral_info("Spectral is disabled"); + if (wlan_spectral_is_feature_disabled_psoc(psoc)) { + spectral_info("Spectral feature is disabled"); return QDF_STATUS_COMP_DISABLED; } @@ -513,8 +513,8 @@ QDF_STATUS wlan_spectral_psoc_close(struct wlan_objmgr_psoc *psoc) return QDF_STATUS_E_INVAL; } - if (wlan_spectral_is_feature_disabled(psoc)) { - spectral_info("Spectral is disabled"); + if (wlan_spectral_is_feature_disabled_psoc(psoc)) { + spectral_info("Spectral feature is disabled"); return QDF_STATUS_COMP_DISABLED; } @@ -528,8 +528,8 @@ QDF_STATUS wlan_spectral_psoc_enable(struct wlan_objmgr_psoc *psoc) return QDF_STATUS_E_INVAL; } - if (wlan_spectral_is_feature_disabled(psoc)) { - spectral_info("Spectral is disabled"); + if (wlan_spectral_is_feature_disabled_psoc(psoc)) { + spectral_info("Spectral feature is disabled"); return QDF_STATUS_COMP_DISABLED; } @@ -543,8 +543,8 @@ QDF_STATUS wlan_spectral_psoc_disable(struct wlan_objmgr_psoc *psoc) return QDF_STATUS_E_INVAL; } - if (wlan_spectral_is_feature_disabled(psoc)) { - spectral_info("Spectral is disabled"); + if (wlan_spectral_is_feature_disabled_psoc(psoc)) { + spectral_info("Spectral feature is disabled"); return QDF_STATUS_COMP_DISABLED; } diff --git a/target_if/spectral/target_if_spectral.c b/target_if/spectral/target_if_spectral.c index c9912f70c8..a1f9969a0e 100644 --- a/target_if/spectral/target_if_spectral.c +++ b/target_if/spectral/target_if_spectral.c @@ -1849,28 +1849,17 @@ target_if_init_spectral_capability(struct target_if_spectral *spectral, pcap = &spectral->capability; pcap->phydiag_cap = 1; pcap->radar_cap = 1; - pcap->spectral_cap = 1; - pcap->advncd_spectral_cap = 1; + pcap->spectral_cap = wlan_pdev_nif_feat_ext_cap_get( + pdev, WLAN_PDEV_FEXT_NORMAL_SPECTRAL_SCAN_DIS); + pcap->advncd_spectral_cap = pcap->spectral_cap; pcap->hw_gen = spectral->spectral_gen; - if (spectral->spectral_gen >= SPECTRAL_GEN3) { - QDF_STATUS status; - struct target_if_spectral_agile_mode_cap agile_cap = { 0 }; - status = target_if_spectral_get_agile_mode_cap(pdev, - &agile_cap); - if (QDF_IS_STATUS_ERROR(status)) { - spectral_err("Failed to get agile mode capability"); - return QDF_STATUS_E_FAILURE; - } - pcap->agile_spectral_cap = agile_cap.agile_spectral_cap; - pcap->agile_spectral_cap_160 = agile_cap.agile_spectral_cap_160; - pcap->agile_spectral_cap_80p80 = - agile_cap.agile_spectral_cap_80p80; - } else { - pcap->agile_spectral_cap = false; - pcap->agile_spectral_cap_160 = false; - pcap->agile_spectral_cap_80p80 = false; - } + pcap->agile_spectral_cap = !wlan_pdev_nif_feat_ext_cap_get( + pdev, WLAN_PDEV_FEXT_AGILE_SPECTRAL_SCAN_DIS); + pcap->agile_spectral_cap_160 = !wlan_pdev_nif_feat_ext_cap_get( + pdev, WLAN_PDEV_FEXT_AGILE_SPECTRAL_SCAN_160_DIS); + pcap->agile_spectral_cap_80p80 = !wlan_pdev_nif_feat_ext_cap_get( + pdev, WLAN_PDEV_FEXT_AGILE_SPECTRAL_SCAN_80P80_DIS); if (scaling_params) { for (param_idx = 0; param_idx < num_bin_scaling_params; diff --git a/target_if/spectral/target_if_spectral.h b/target_if/spectral/target_if_spectral.h index dddcfb77b9..9ce7f35f21 100644 --- a/target_if/spectral/target_if_spectral.h +++ b/target_if/spectral/target_if_spectral.h @@ -1722,8 +1722,8 @@ void target_if_spectral_set_rxchainmask(struct wlan_objmgr_pdev *pdev, } if (rx_ops->sptrl_rx_ops. - sptrlro_spectral_is_feature_disabled(psoc)) { - spectral_info("Spectral is disabled"); + sptrlro_spectral_is_feature_disabled_pdev(pdev)) { + spectral_info("Spectral feature is disabled"); return; }