qcacld-3.0: Featurize Dynamic Voltage Config

Host provides INI way to control voltage configs, featurizing the
same for Genoa.

Change-Id: Ia58d84eb2e2a67ead189a51d2a0b98230513f8f9
CRs-Fixed: 2304125
diff --git a/Kbuild b/Kbuild
index 3415959..36fb1e2 100755
--- a/Kbuild
+++ b/Kbuild
@@ -2260,6 +2260,9 @@
 #Flag to enable set and get disable channel list feature
 cppflags-$(CONFIG_DISABLE_CHANNEL_LIST) += -DDISABLE_CHANNEL_LIST
 
+#Flag to enable Dynamic Voltage WDCVS (Config Voltage Mode)
+cppflags-$(CONFIG_WLAN_DYNAMIC_CVM) += -DFEATURE_WLAN_DYNAMIC_CVM
+
 # configure log buffer size
 ifdef CONFIG_CFG_NUM_DP_TRACE_RECORD
 ccflags-y += -DMAX_QDF_DP_TRACE_RECORDS=$(CONFIG_CFG_NUM_DP_TRACE_RECORD)
diff --git a/configs/default_defconfig b/configs/default_defconfig
index 98d1e82..3731a17 100644
--- a/configs/default_defconfig
+++ b/configs/default_defconfig
@@ -548,6 +548,9 @@
 #Flag to enable set and get disable channel list feature
 CONFIG_DISABLE_CHANNEL_LIST :=y
 
+#Flag to enable Dynamic Voltage WDCVS (Config Voltage Mode)
+CONFIG_WLAN_DYNAMIC_CVM := y
+
 CONFIG_WIFI_POS_CONVERGED := y
 ifneq ($(CONFIG_WIFI_POS_CONVERGED), y)
 CONFIG_WIFI_POS_LEGACY := y
diff --git a/configs/genoa.common b/configs/genoa.common
index b99b1ea..2679e3b 100644
--- a/configs/genoa.common
+++ b/configs/genoa.common
@@ -45,6 +45,10 @@
 CONFIG_FEATURE_MONITOR_MODE_SUPPORT := n
 CONFIG_DP_TRACE := y
 CONFIG_QCACLD_FEATURE_METERING := n
+
+#Flag to enable Dynamic Voltage WDCVS (Config Voltage Mode)
+CONFIG_WLAN_DYNAMIC_CVM := n
+
 #We might need to disable WEXT support in perf builds in future
 CONFIG_WLAN_WEXT_SUPPORT_ENABLE := y
 
diff --git a/configs/genoa.snoc.debug_defconfig b/configs/genoa.snoc.debug_defconfig
index 3bed4c6..9cce65b 100644
--- a/configs/genoa.snoc.debug_defconfig
+++ b/configs/genoa.snoc.debug_defconfig
@@ -71,6 +71,8 @@
 
 # other features
 
+#Flag to enable Dynamic Voltage WDCVS (Config Voltage Mode)
+CONFIG_WLAN_DYNAMIC_CVM := y
 ifeq ($(CONFIG_CNSS2), y)
 ifeq ($(CONFIG_HIF_PCI), y)
 CONFIG_PLD_PCIE_CNSS_FLAG := y
diff --git a/configs/genoa.snoc.perf_defconfig b/configs/genoa.snoc.perf_defconfig
index 102bb88..5c89058 100644
--- a/configs/genoa.snoc.perf_defconfig
+++ b/configs/genoa.snoc.perf_defconfig
@@ -53,6 +53,9 @@
 CONFIG_WLAN_LOG_ENTER := n
 CONFIG_WLAN_LOG_EXIT := n
 
+#Flag to enable Dynamic Voltage WDCVS (Config Voltage Mode)
+CONFIG_WLAN_DYNAMIC_CVM := y
+
 # Features gets enabled on slub debug
 CONFIG_WLAN_OBJMGR_DEBUG:= n
 CONFIG_FEATURE_MEMDUMP_ENABLE := n
diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h
index 014b13b..687a809 100644
--- a/core/hdd/inc/wlan_hdd_cfg.h
+++ b/core/hdd/inc/wlan_hdd_cfg.h
@@ -13926,8 +13926,10 @@
 	/* length includes separator */
 	char rm_capability[3 * DOT11F_IE_RRMENABLEDCAP_MAX_LEN];
 
+#ifdef FEATURE_WLAN_DYNAMIC_CVM
 	/* Bitmap for operating voltage corner mode */
 	uint32_t vc_mode_cfg_bitmap;
+#endif
 
 #ifdef MWS_COEX
 	/* Bitmap for MWS-COEX 4G Quick FTDM */
diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c
index 9e745f5..2d22552 100644
--- a/core/hdd/src/wlan_hdd_cfg.c
+++ b/core/hdd/src/wlan_hdd_cfg.c
@@ -618,12 +618,14 @@
 		     CFG_ENABLE_LTE_COEX_MIN,
 		     CFG_ENABLE_LTE_COEX_MAX),
 
+#ifdef FEATURE_WLAN_DYNAMIC_CVM
 	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),
+#endif
 
 	REG_VARIABLE(CFG_ENABLE_SAP_MANDATORY_CHAN_LIST, WLAN_PARAM_Integer,
 		     struct hdd_config, enable_sap_mandatory_chan_list,
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index 0918162..b838c9f 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -10248,6 +10248,18 @@
 			evt->vdev_id);
 }
 
+#ifdef FEATURE_WLAN_DYNAMIC_CVM
+static inline int hdd_set_vc_mode_config(struct hdd_context *hdd_ctx)
+{
+	return sme_set_vc_mode_config(hdd_ctx->config->vc_mode_cfg_bitmap);
+}
+#else
+static inline int hdd_set_vc_mode_config(struct hdd_context *hdd_ctx)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
 /**
  * hdd_adaptive_dwelltime_init() - initialization for adaptive dwell time config
  * @hdd_ctx: HDD context
@@ -10456,7 +10468,7 @@
 	if (hdd_ctx->config->enable_go_cts2self_for_sta)
 		sme_set_cts2self_for_p2p_go(mac_handle);
 
-	if (sme_set_vc_mode_config(hdd_ctx->config->vc_mode_cfg_bitmap))
+	if (hdd_set_vc_mode_config(hdd_ctx))
 		hdd_warn("Error in setting Voltage Corner mode config to FW");
 
 	if (hdd_rx_ol_init(hdd_ctx))
diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h
index 713aecd..b940ff4 100644
--- a/core/sme/inc/sme_api.h
+++ b/core/sme/inc/sme_api.h
@@ -2152,6 +2152,7 @@
 		bool is_tos_active, uint32_t max_off_chan_time,
 		uint32_t rest_time, bool skip_dfs_chan);
 
+#ifdef FEATURE_WLAN_DYNAMIC_CVM
 /**
  * sme_set_vc_mode_config() - Set voltage corner config to FW.
  * @bitmap:	Bitmap that refers to voltage corner config with
@@ -2160,6 +2161,7 @@
  * Return: QDF_STATUS
  */
 QDF_STATUS sme_set_vc_mode_config(uint32_t vc_bitmap);
+#endif
 
 /**
  * sme_set_del_pmkid_cache() - API to update PMKID cache
diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c
index 2e0b58c..964f0ab 100644
--- a/core/sme/src/common/sme_api.c
+++ b/core/sme/src/common/sme_api.c
@@ -15633,6 +15633,7 @@
 		      session->disconnect_stats.peer_kickout);
 }
 
+#ifdef FEATURE_WLAN_DYNAMIC_CVM
  /**
  * sme_set_vc_mode_config() - Set voltage corner config to FW
  * @bitmap:	Bitmap that referes to voltage corner config with
@@ -15659,6 +15660,7 @@
 	}
 	return QDF_STATUS_SUCCESS;
 }
+#endif
 
 /**
  * sme_set_bmiss_bcnt() - set bmiss config parameters
diff --git a/core/wma/inc/wma_api.h b/core/wma/inc/wma_api.h
index 8d79161..e5bda03 100644
--- a/core/wma/inc/wma_api.h
+++ b/core/wma/inc/wma_api.h
@@ -364,6 +364,7 @@
  */
 uint32_t wma_critical_events_in_flight(void);
 
+#ifdef FEATURE_WLAN_DYNAMIC_CVM
 /**
  * wma_set_vc_mode_config() - set voltage corner mode config to FW.
  * @wma_handle:	pointer to wma handle.
@@ -376,6 +377,7 @@
  */
 QDF_STATUS wma_set_vc_mode_config(void *wma_handle,
 		uint32_t vc_bitmap);
+#endif
 
 QDF_STATUS wma_process_dhcp_ind(WMA_HANDLE wma_handle,
 				tAniDHCPInd *ta_dhcp_ind);
diff --git a/core/wma/src/wma_utils.c b/core/wma/src/wma_utils.c
index 68df2c6..83a7637 100644
--- a/core/wma/src/wma_utils.c
+++ b/core/wma/src/wma_utils.c
@@ -4523,6 +4523,7 @@
 }
 #endif /* WLAN_FEATURE_LINK_LAYER_STATS */
 
+#ifdef FEATURE_WLAN_DYNAMIC_CVM
 /**
  * wma_set_vc_mode_config() - set voltage corner mode config to FW.
  * @wma_handle:	pointer to wma handle.
@@ -4557,6 +4558,7 @@
 
 	return QDF_STATUS_SUCCESS;
 }
+#endif
 
 int wma_chip_power_save_failure_detected_handler(void *handle,
 						 uint8_t  *cmd_param_info,