diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index 4d56e5df7187..1c1cee756a2a 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -6332,6 +6332,49 @@ static bool hdd_is_supported_chain_mask_1x1(hdd_context_t *hdd_ctx) return (!hdd_ctx->config->enable2x2) ? true : false; } +QDF_STATUS hdd_update_smps_antenna_mode(hdd_context_t *hdd_ctx, int mode) +{ + QDF_STATUS status; + uint8_t smps_mode; + uint8_t smps_enable; + + /* Update SME SMPS config */ + if (HDD_ANTENNA_MODE_1X1 == mode) { + smps_enable = true; + smps_mode = HDD_SMPS_MODE_STATIC; + } else { + smps_enable = false; + smps_mode = HDD_SMPS_MODE_DISABLED; + } + + hdd_debug("Update SME SMPS enable: %d mode: %d", + smps_enable, smps_mode); + status = sme_update_mimo_power_save( + hdd_ctx->hHal, smps_enable, smps_mode, false); + if (QDF_STATUS_SUCCESS != status) { + hdd_err("Update SMPS config failed enable: %d mode: %d" + "status: %d", + smps_enable, smps_mode, status); + return QDF_STATUS_E_FAILURE; + } + + hdd_ctx->current_antenna_mode = mode; + /* + * Update the user requested nss in the mac context. + * This will be used in tdls protocol engine to form tdls + * Management frames. + */ + sme_update_user_configured_nss( + hdd_ctx->hHal, + hdd_ctx->current_antenna_mode); + + hdd_debug("Successfully switched to mode: %d x %d", + hdd_ctx->current_antenna_mode, + hdd_ctx->current_antenna_mode); + + return QDF_STATUS_SUCCESS; +} + /** * drv_cmd_set_antenna_mode() - SET ANTENNA MODE driver command * handler @@ -6352,8 +6395,6 @@ static int drv_cmd_set_antenna_mode(hdd_adapter_t *adapter, int ret = 0; int mode; uint8_t *value = command; - uint8_t smps_mode; - uint8_t smps_enable; if (((1 << QDF_STA_MODE) != hdd_ctx->concurrency_mode) || (hdd_ctx->no_of_active_sessions[QDF_STA_MODE] > 1)) { @@ -6440,38 +6481,11 @@ static int drv_cmd_set_antenna_mode(hdd_adapter_t *adapter, goto exit; } - /* Update SME SMPS config */ - if (HDD_ANTENNA_MODE_1X1 == mode) { - smps_enable = true; - smps_mode = HDD_SMPS_MODE_STATIC; - } else { - smps_enable = false; - smps_mode = HDD_SMPS_MODE_DISABLED; - } - - hdd_debug("Update SME SMPS enable: %d mode: %d", - smps_enable, smps_mode); - status = sme_update_mimo_power_save( - hdd_ctx->hHal, smps_enable, smps_mode, false); + status = hdd_update_smps_antenna_mode(hdd_ctx, mode); if (QDF_STATUS_SUCCESS != status) { - hdd_err("Update SMPS config failed enable: %d mode: %d status: %d", - smps_enable, smps_mode, status); ret = -EFAULT; goto exit; } - - hdd_ctx->current_antenna_mode = mode; - /* Update the user requested nss in the mac context. - * This will be used in tdls protocol engine to form tdls - * Management frames. - */ - sme_update_user_configured_nss( - hdd_ctx->hHal, - hdd_ctx->current_antenna_mode); - - hdd_debug("Successfully switched to mode: %d x %d", - hdd_ctx->current_antenna_mode, - hdd_ctx->current_antenna_mode); ret = 0; exit: #ifdef FEATURE_WLAN_TDLS diff --git a/core/hdd/src/wlan_hdd_ioctl.h b/core/hdd/src/wlan_hdd_ioctl.h index f17e410d0032..cc0107ea6e68 100644 --- a/core/hdd/src/wlan_hdd_ioctl.h +++ b/core/hdd/src/wlan_hdd_ioctl.h @@ -37,5 +37,15 @@ extern struct sock *cesium_nl_srv_sock; int hdd_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); int wlan_hdd_set_mc_rate(hdd_adapter_t *pAdapter, int targetRate); +/** + * hdd_update_smps_antenna_mode() - set smps and antenna mode + * @hdd_ctx: Pointer to hdd context + * @mode: antenna mode + * + * This function will set smps and antenna mode. + * + * Return: QDF_STATUS + */ +QDF_STATUS hdd_update_smps_antenna_mode(hdd_context_t *hdd_ctx, int mode); #endif /* end #if !defined(WLAN_HDD_IOCTL_H) */ diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 822a184ec8d5..4a6d575f578d 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -1391,6 +1391,7 @@ void hdd_update_tgt_cfg(void *context, void *param) struct wma_tgt_cfg *cfg = param; uint8_t temp_band_cap; struct cds_config_info *cds_cfg = cds_get_ini_config(); + uint8_t antenna_mode; /* Reuse same pdev for module stop and start */ if ((hdd_get_conparam() == QDF_GLOBAL_FTM_MODE) || @@ -1493,9 +1494,9 @@ void hdd_update_tgt_cfg(void *context, void *param) hdd_debug("fine_time_meas_cap: 0x%x", hdd_ctx->config->fine_time_meas_cap); - hdd_ctx->current_antenna_mode = - (hdd_ctx->config->enable2x2 == 0x01) ? - HDD_ANTENNA_MODE_2X2 : HDD_ANTENNA_MODE_1X1; + antenna_mode = (hdd_ctx->config->enable2x2 == 0x01) ? + HDD_ANTENNA_MODE_2X2 : HDD_ANTENNA_MODE_1X1; + hdd_update_smps_antenna_mode(hdd_ctx, antenna_mode); hdd_debug("Init current antenna mode: %d", hdd_ctx->current_antenna_mode);