From 8983cf61d2fc6f8b39170e71779bc15077ef356c Mon Sep 17 00:00:00 2001 From: Nachiket Kukade Date: Thu, 12 Oct 2017 18:14:48 +0530 Subject: [PATCH] qcacld-3.0: Support for configuring voltage corner mode This change adds support for configuring voltage corner mode thorugh INI parameter. User will provide a bitmap which will be passed on to the FW during initialization. In this bitmap, each pair of bits till BIT27 correspond to different phymode, bw combination. Bit values signify voltage corner configuration. Change-Id: I9e86d43079225b6f08fdd281c8f424b18abcffe9 CRs-Fixed: 2109884 --- core/hdd/inc/wlan_hdd_cfg.h | 49 +++++++++++++++++++++++++++++++++++ core/hdd/src/wlan_hdd_cfg.c | 9 +++++++ core/hdd/src/wlan_hdd_main.c | 3 +++ core/sme/inc/sme_api.h | 9 +++++++ core/sme/src/common/sme_api.c | 27 +++++++++++++++++++ core/wma/inc/wma_api.h | 14 ++++++++++ core/wma/src/wma_utils.c | 35 +++++++++++++++++++++++++ 7 files changed, 146 insertions(+) diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index 796fbf254cbc..9787a8836443 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -5646,6 +5646,52 @@ enum hdd_link_speed_rpt_type { #define CFG_ENABLE_DYNAMIC_DTIM_MAX (9) #define CFG_ENABLE_DYNAMIC_DTIM_DEFAULT (0) +/* + * + * gConfigVCmodeBitmap - Bitmap for operating voltage corner mode + * @Min: 0x00000000 + * @Max: 0x0fffffff + * @Default: 0x0000000a + * This ini is used to set operating voltage corner mode for differenet + * phymode and bw configurations. Every 2 bits till BIT27 are dedicated + * for a specific configuration. Bit values decide the type of voltage + * corner mode. All the details below - + * + * Configure operating voltage corner mode based on phymode and bw. + * bit 0-1 - operating voltage corner mode for 11a/b. + * bit 2-3 - operating voltage corner mode for 11g. + * bit 4-5 - operating voltage corner mode for 11n, 20MHz, 1x1. + * bit 6-7 - operating voltage corner mode for 11n, 20MHz, 2x2. + * bit 8-9 - operating voltage corner mode for 11n, 40MHz, 1x1. + * bit 10-11 - operating voltage corner mode for 11n, 40MHz, 2x2. + * bit 12-13 - operating voltage corner mode for 11ac, 20MHz, 1x1. + * bit 14-15 - operating voltage corner mode for 11ac, 20MHz, 2x2. + * bit 16-17 - operating voltage corner mode for 11ac, 40MHz, 1x1. + * bit 18-19 - operating voltage corner mode for 11ac, 40MHz, 2x2. + * bit 20-21 - operating voltage corner mode for 11ac, 80MHz, 1x1. + * bit 22-23 - operating voltage corner mode for 11ac, 80MHz, 2x2. + * bit 24-25 - operating voltage corner mode for 11ac, 160MHz, 1x1. + * bit 26-27 - operating voltage corner mode for 11ac, 160MHz, 2x2. + * --------------------------------------------- + * 00 - Static voltage corner SVS + * 01 - static voltage corner LOW SVS + * 10 - Dynamic voltage corner selection based on TPUT + * 11 - Dynamic voltage corner selection based on TPUT and Tx Flush counters + + * Related: None + * + * Supported Feature: None + * + * Usage: External + * + * + */ + +#define CFG_VC_MODE_BITMAP "gConfigVCmode" +#define CFG_VC_MODE_BITMAP_MIN (0x00000000) +#define CFG_VC_MODE_BITMAP_MAX (0x0fffffff) +#define CFG_VC_MODE_BITMAP_DEFAULT (0x00000005) + /* * * gApAutoChannelSelection - Force ACS from ini @@ -13211,6 +13257,9 @@ struct hdd_config { /* Vowifi 11r params */ bool fFTResourceReqSupported; + /* Bitmap for operating voltage corner mode */ + uint32_t vc_mode_cfg_bitmap; + uint16_t nNeighborScanPeriod; uint16_t neighbor_scan_min_period; uint8_t nNeighborLookupRssiThreshold; diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index 95a71981dfe6..3c52f37d1ec3 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -619,6 +619,13 @@ struct reg_table_entry g_registry_table[] = { CFG_ENABLE_LTE_COEX_MIN, CFG_ENABLE_LTE_COEX_MAX), + REG_VARIABLE(CFG_VC_MODE_BITMAP, WLAN_PARAM_HexInteger, + struct hdd_config, vc_mode_cfg_bitmap, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_VC_MODE_BITMAP_DEFAULT, + CFG_VC_MODE_BITMAP_MIN, + CFG_VC_MODE_BITMAP_MAX), + REG_VARIABLE(CFG_FORCE_SAP_ACS, WLAN_PARAM_Integer, struct hdd_config, force_sap_acs, VAR_FLAGS_DYNAMIC_CFG | @@ -6945,6 +6952,8 @@ void hdd_cfg_print(struct hdd_context *hdd_ctx) hdd_debug("Name = [%s] value = [%u]", CFG_OCE_WAN_SCORE_IDX15_TO_12_NAME, hdd_ctx->config->oce_wan_score_slots15_to_12); + hdd_debug("Name = [%s] value = [0x%x]", CFG_VC_MODE_BITMAP, + hdd_ctx->config->vc_mode_cfg_bitmap); } diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 4a801ffd9968..e7607e4b31ab 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -9151,6 +9151,9 @@ static int hdd_features_init(struct hdd_context *hdd_ctx, struct hdd_adapter *ad if (hdd_ctx->config->enable_go_cts2self_for_sta) sme_set_cts2self_for_p2p_go(hdd_ctx->hHal); + if (sme_set_vc_mode_config(hdd_ctx->config->vc_mode_cfg_bitmap)) + hdd_warn("Error in setting Voltage Corner mode config to FW"); + if (hdd_lro_init(hdd_ctx)) hdd_err("Unable to initialize LRO in fw"); diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index ed78a3f2a4f1..69d1802b02bb 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -1789,4 +1789,13 @@ QDF_STATUS sme_send_limit_off_channel_params(tHalHandle hal, uint8_t vdev_id, bool is_tos_active, uint32_t max_off_chan_time, uint32_t rest_time, bool skip_dfs_chan); +/** + * sme_set_vc_mode_config() - Set voltage corner config to FW. + * @bitmap: Bitmap that refers to voltage corner config with + * different phymode and bw configuration + * + * Return: QDF_STATUS + */ +QDF_STATUS sme_set_vc_mode_config(uint32_t vc_bitmap); + #endif /* #if !defined( __SME_API_H ) */ diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index c33ce0a36403..df703d0acf44 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -16074,6 +16074,33 @@ void sme_display_disconnect_stats(tHalHandle hal, uint8_t session_id) session->disconnect_stats.peer_kickout); } + /** + * sme_set_vc_mode_config() - Set voltage corner config to FW + * @bitmap: Bitmap that referes to voltage corner config with + * different phymode and bw configuration + * + * Return: QDF_STATUS + */ +QDF_STATUS sme_set_vc_mode_config(uint32_t vc_bitmap) +{ + void *wma_handle; + + wma_handle = cds_get_context(QDF_MODULE_ID_WMA); + if (!wma_handle) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + "wma_handle is NULL"); + return QDF_STATUS_E_FAILURE; + } + if (QDF_STATUS_SUCCESS != + wma_set_vc_mode_config(wma_handle, vc_bitmap)) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + "%s: Failed to set Voltage Control config to FW", + __func__); + return QDF_STATUS_E_FAILURE; + } + return QDF_STATUS_SUCCESS; +} + /** * sme_set_bmiss_bcnt() - set bmiss config parameters * @vdev_id: virtual device for the command diff --git a/core/wma/inc/wma_api.h b/core/wma/inc/wma_api.h index 8578e5bd1931..6beab5dfd966 100644 --- a/core/wma/inc/wma_api.h +++ b/core/wma/inc/wma_api.h @@ -337,4 +337,18 @@ tSirWifiPeerType wmi_to_sir_peer_type(enum wmi_peer_type type); QDF_STATUS wma_crash_inject(WMA_HANDLE wma_handle, uint32_t type, uint32_t delay_time_ms); + +/** + * wma_set_vc_mode_config() - set voltage corner mode config to FW. + * @wma_handle: pointer to wma handle. + * @vc_bitmap: value needs to set to firmware. + * + * At the time of driver startup, set operating voltage corner mode + * for differenet phymode and bw configurations. + * + * Return: QDF_STATUS. + */ +QDF_STATUS wma_set_vc_mode_config(void *wma_handle, + uint32_t vc_bitmap); + #endif diff --git a/core/wma/src/wma_utils.c b/core/wma/src/wma_utils.c index 6722136f90ff..e10193a95de9 100644 --- a/core/wma/src/wma_utils.c +++ b/core/wma/src/wma_utils.c @@ -4619,6 +4619,41 @@ tSirWifiPeerType wmi_to_sir_peer_type(enum wmi_peer_type type) } } +/** + * wma_set_vc_mode_config() - set voltage corner mode config to FW. + * @wma_handle: pointer to wma handle. + * @vc_bitmap: value needs to set to firmware. + * + * At the time of driver startup, set operating voltage corner mode + * for differenet phymode and bw configurations. + * + * Return: QDF_STATUS. + */ +QDF_STATUS wma_set_vc_mode_config(void *wma_handle, + uint32_t vc_bitmap) +{ + int32_t ret; + tp_wma_handle wma = (tp_wma_handle)wma_handle; + struct pdev_params pdevparam; + + pdevparam.param_id = WMI_PDEV_UPDATE_WDCVS_ALGO; + pdevparam.param_value = vc_bitmap; + + ret = wmi_unified_pdev_param_send(wma->wmi_handle, + &pdevparam, + WMA_WILDCARD_PDEV_ID); + if (ret) { + WMA_LOGE("Fail to Set Voltage Corner config (0x%x)", + vc_bitmap); + return QDF_STATUS_E_FAILURE; + } + + WMA_LOGD("Successfully Set Voltage Corner config (0x%x)", + vc_bitmap); + + return QDF_STATUS_SUCCESS; +} + int wma_chip_power_save_failure_detected_handler(void *handle, uint8_t *cmd_param_info, uint32_t len)