diff --git a/spectral/dispatcher/inc/wlan_spectral_utils_api.h b/spectral/dispatcher/inc/wlan_spectral_utils_api.h index a328727e6a..ab213bf7ac 100644 --- a/spectral/dispatcher/inc/wlan_spectral_utils_api.h +++ b/spectral/dispatcher/inc/wlan_spectral_utils_api.h @@ -29,12 +29,42 @@ struct spectral_wmi_ops; struct spectral_tgt_ops; /** - * wlan_spectral_is_feature_disabled() - Check if spectral feature is disabled - * @psoc - the physical device object. + * wlan_spectral_is_feature_disabled_pdev() - Check if spectral feature + * is disabled for a given pdev + * @pdev - pointer to pdev * * Return : true if spectral is disabled, else false. */ -bool wlan_spectral_is_feature_disabled(struct wlan_objmgr_psoc *psoc); +bool wlan_spectral_is_feature_disabled_pdev(struct wlan_objmgr_pdev *pdev); + +/** + * wlan_spectral_is_feature_disabled_ini() - Check if spectral feature + * is disabled in INI + * @psoc - pointer to psoc + * + * Return : true if spectral is disabled, else false. + */ +bool wlan_spectral_is_feature_disabled_ini(struct wlan_objmgr_psoc *psoc); + +/** + * wlan_spectral_is_feature_disabled_psoc() - Check if spectral feature + * is disabled for a given psoc + * @psoc - pointer to psoc + * + * Return : true if spectral is disabled, else false. + */ +bool wlan_spectral_is_feature_disabled_psoc(struct wlan_objmgr_psoc *psoc); + +/** + * wlan_spectral_is_mode_disabled_pdev() - Check if a given spectral mode + * is disabled for a given pdev + * @pdev - pointer to pdev + * @smode - spectral scan mode + * + * Return : true if spectral mode is disabled, else false. + */ +bool wlan_spectral_is_mode_disabled_pdev(struct wlan_objmgr_pdev *pdev, + enum spectral_scan_mode smode); /** * wlan_spectral_init() - API to init spectral component diff --git a/spectral/dispatcher/src/wlan_spectral_utils_api.c b/spectral/dispatcher/src/wlan_spectral_utils_api.c index 850ea14037..861a600937 100644 --- a/spectral/dispatcher/src/wlan_spectral_utils_api.c +++ b/spectral/dispatcher/src/wlan_spectral_utils_api.c @@ -23,17 +23,79 @@ #include #include -bool wlan_spectral_is_feature_disabled(struct wlan_objmgr_psoc *psoc) +bool wlan_spectral_is_mode_disabled_pdev(struct wlan_objmgr_pdev *pdev, + enum spectral_scan_mode smode) +{ + bool spectral_mode_disable; + + if (!pdev) { + spectral_err("pdev is NULL!"); + return true; + } + + switch (smode) { + case SPECTRAL_SCAN_MODE_NORMAL: + spectral_mode_disable = wlan_pdev_nif_feat_ext_cap_get( + pdev, WLAN_PDEV_FEXT_NORMAL_SPECTRAL_SCAN_DIS); + break; + + case SPECTRAL_SCAN_MODE_AGILE: + spectral_mode_disable = wlan_pdev_nif_feat_ext_cap_get( + pdev, WLAN_PDEV_FEXT_AGILE_SPECTRAL_SCAN_DIS) && + wlan_pdev_nif_feat_ext_cap_get( + pdev, WLAN_PDEV_FEXT_AGILE_SPECTRAL_SCAN_160_DIS) && + wlan_pdev_nif_feat_ext_cap_get( + pdev, WLAN_PDEV_FEXT_AGILE_SPECTRAL_SCAN_80P80_DIS); + break; + + default: + spectral_err("Invalid Spectral scan mode %d", smode); + spectral_mode_disable = true; + break; + } + + return spectral_mode_disable; +} + +bool +wlan_spectral_is_feature_disabled_ini(struct wlan_objmgr_psoc *psoc) { if (!psoc) { spectral_err("PSOC is NULL!"); return true; } - if (wlan_psoc_nif_feat_cap_get(psoc, WLAN_SOC_F_SPECTRAL_INI_DISABLE)) - return true; + return wlan_psoc_nif_feat_cap_get(psoc, + WLAN_SOC_F_SPECTRAL_INI_DISABLE); +} - return false; +bool +wlan_spectral_is_feature_disabled_psoc(struct wlan_objmgr_psoc *psoc) +{ + if (!psoc) { + spectral_err("psoc is NULL!"); + return true; + } + + return wlan_spectral_is_feature_disabled_ini(psoc); +} + +bool +wlan_spectral_is_feature_disabled_pdev(struct wlan_objmgr_pdev *pdev) +{ + enum spectral_scan_mode smode; + + if (!pdev) { + spectral_err("pdev is NULL!"); + return true; + } + + smode = SPECTRAL_SCAN_MODE_NORMAL; + for (; smode < SPECTRAL_SCAN_MODE_MAX; smode++) + if (!wlan_spectral_is_mode_disabled_pdev(pdev, smode)) + return false; + + return true; } QDF_STATUS @@ -247,8 +309,10 @@ wlan_lmac_if_sptrl_register_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops) sptrl_rx_ops->sptrlro_vdev_get_ch_width = spectral_vdev_get_ch_width; sptrl_rx_ops->sptrlro_vdev_get_sec20chan_freq_mhz = spectral_vdev_get_sec20chan_freq_mhz; - sptrl_rx_ops->sptrlro_spectral_is_feature_disabled = - wlan_spectral_is_feature_disabled; + sptrl_rx_ops->sptrlro_spectral_is_feature_disabled_pdev = + wlan_spectral_is_feature_disabled_pdev; + sptrl_rx_ops->sptrlro_spectral_is_feature_disabled_psoc = + wlan_spectral_is_feature_disabled_psoc; } QDF_STATUS diff --git a/target_if/spectral/target_if_spectral.c b/target_if/spectral/target_if_spectral.c index b61111fe7c..c9912f70c8 100644 --- a/target_if/spectral/target_if_spectral.c +++ b/target_if/spectral/target_if_spectral.c @@ -231,12 +231,31 @@ static QDF_STATUS target_if_spectral_init_pdev_feature_cap_per_mode(struct wlan_objmgr_pdev *pdev, enum spectral_scan_mode smode) { + struct wlan_objmgr_psoc *psoc; bool normal_mode_disable; struct target_if_spectral_agile_mode_cap agile_cap = { 0 }; QDF_STATUS status; + if (!pdev) { + spectral_err("pdev is null"); + return QDF_STATUS_E_INVAL; + } + + psoc = wlan_pdev_get_psoc(pdev); + if (!psoc) { + spectral_err("psoc is null"); + return QDF_STATUS_E_INVAL; + } + switch (smode) { case SPECTRAL_SCAN_MODE_NORMAL: + if (target_if_spectral_is_feature_disabled_psoc(psoc)) { + wlan_pdev_nif_feat_ext_cap_set( + pdev, WLAN_PDEV_FEXT_NORMAL_SPECTRAL_SCAN_DIS); + + return QDF_STATUS_SUCCESS; + } + status = target_if_spectral_get_normal_mode_cap( pdev, &normal_mode_disable); if (QDF_IS_STATUS_ERROR(status)) { @@ -253,6 +272,16 @@ target_if_spectral_init_pdev_feature_cap_per_mode(struct wlan_objmgr_pdev *pdev, break; case SPECTRAL_SCAN_MODE_AGILE: + if (target_if_spectral_is_feature_disabled_psoc(psoc)) { + wlan_pdev_nif_feat_ext_cap_set( + pdev, WLAN_PDEV_FEXT_AGILE_SPECTRAL_SCAN_DIS); + wlan_pdev_nif_feat_ext_cap_set( + pdev, WLAN_PDEV_FEXT_AGILE_SPECTRAL_SCAN_160_DIS); + wlan_pdev_nif_feat_ext_cap_set( + pdev, WLAN_PDEV_FEXT_AGILE_SPECTRAL_SCAN_80P80_DIS); + + return QDF_STATUS_SUCCESS; + } status = target_if_spectral_get_agile_mode_cap( pdev, &agile_cap); if (QDF_IS_STATUS_ERROR(status)) { diff --git a/target_if/spectral/target_if_spectral.h b/target_if/spectral/target_if_spectral.h index 0adec944ef..dddcfb77b9 100644 --- a/target_if/spectral/target_if_spectral.h +++ b/target_if/spectral/target_if_spectral.h @@ -1657,6 +1657,37 @@ int target_if_vdev_get_sec20chan_freq_mhz( sptrlro_vdev_get_sec20chan_freq_mhz(vdev, sec20chan_freq); } +/** + * target_if_spectral_is_feature_disabled_psoc() - Check if Spectral feature is + * disabled for a given psoc + * @psoc: Pointer to psoc + * + * Return: true or false + */ +static inline +bool target_if_spectral_is_feature_disabled_psoc(struct wlan_objmgr_psoc *psoc) +{ + struct wlan_lmac_if_rx_ops *rx_ops; + + if (!psoc) { + spectral_err("psoc is NULL"); + return true; + } + + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + if (!rx_ops) { + spectral_err("rx_ops is null"); + return true; + } + + if (rx_ops->sptrl_rx_ops. + sptrlro_spectral_is_feature_disabled_psoc) + return rx_ops->sptrl_rx_ops. + sptrlro_spectral_is_feature_disabled_psoc(psoc); + + return true; +} + /** * target_if_spectral_set_rxchainmask() - Set Spectral Rx chainmask * @pdev: Pointer to pdev diff --git a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h index 313431167f..1abc411896 100644 --- a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h +++ b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h @@ -1393,7 +1393,10 @@ struct wlan_lmac_if_cfr_rx_ops { * @sptrlro_get_psoc_target_handle: Get Spectral handle for psoc target * private data * @sptrlro_vdev_get_chan_freq_seg2: Get secondary 80 center frequency - * @sptrlro_spectral_is_feature_disabled: Check if spectral feature is disabled + * @sptrlro_spectral_is_feature_disabled_pdev: Check if spectral feature is + * disabled for a given pdev + * @sptrlro_spectral_is_feature_disabled_psoc: Check if spectral feature is + * disabled for a given psoc */ struct wlan_lmac_if_sptrl_rx_ops { void * (*sptrlro_get_pdev_target_handle)(struct wlan_objmgr_pdev *pdev); @@ -1406,7 +1409,9 @@ struct wlan_lmac_if_sptrl_rx_ops { int (*sptrlro_vdev_get_sec20chan_freq_mhz)( struct wlan_objmgr_vdev *vdev, uint16_t *sec20chan_freq); - bool (*sptrlro_spectral_is_feature_disabled)( + bool (*sptrlro_spectral_is_feature_disabled_pdev)( + struct wlan_objmgr_pdev *pdev); + bool (*sptrlro_spectral_is_feature_disabled_psoc)( struct wlan_objmgr_psoc *psoc); }; #endif /* WLAN_CONV_SPECTRAL_ENABLE */