Browse Source

qcacld-3.0: Add ini support for cpu cxpc threshold

Currently cpu cxpc threshold is hardcoded in host driver.
As, Each platform has different threshold for PM QoS and
this threshold needs to be set accordingly.

To address above issue, add new ini to set cpu cxpc threshold.

Change-Id: I34d1e7f836585f3ff5e8d0044c6c224f58e99776
CRs-Fixed: 3263352
Ashish Kumar Dhanotiya 2 years ago
parent
commit
2bfe9c0cc2

+ 32 - 1
core/hdd/inc/hdd_config.h

@@ -160,6 +160,36 @@ enum hdd_dot11_mode {
 #define CFG_GET_WIFI_FEATURES_ALL
 #endif
 
+#ifdef FEATURE_RUNTIME_PM
+/*
+ * <ini>
+ * cpu_cxpc_threshold - PM QOS threshold
+ * @Min: 0
+ * @Max: 15000
+ * @Default: 10000
+ *
+ * This ini is used to set PM QOS threshold value
+ *
+ * Related: None.
+ *
+ * Supported Feature: ALL
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+ #define CFG_CPU_CXPC_THRESHOLD CFG_INI_UINT( \
+			"cpu_cxpc_threshold", \
+			0, \
+			15000, \
+			10000, \
+			CFG_VALUE_OR_DEFAULT, \
+			"PM QOS threshold")
+#define CFG_CPU_CXPC_THRESHOLD_ALL CFG(CFG_CPU_CXPC_THRESHOLD)
+#else
+#define CFG_CPU_CXPC_THRESHOLD_ALL
+#endif
+
 #ifdef QCA_WIFI_EMULATION
 #define CFG_INTERFACE_CHANGE_WAIT_DEFAULT	300000
 #else
@@ -1972,5 +2002,6 @@ enum host_log_level {
 	CFG(CFG_SAR_CONVERSION) \
 	CFG(CFG_ENABLE_HOST_MODULE_LOG_LEVEL) \
 	SAR_SAFETY_FEATURE_ALL \
-	CFG_GET_WIFI_FEATURES_ALL
+	CFG_GET_WIFI_FEATURES_ALL \
+	CFG_CPU_CXPC_THRESHOLD_ALL
 #endif

+ 3 - 0
core/hdd/inc/wlan_hdd_cfg.h

@@ -207,6 +207,9 @@ struct hdd_config {
 #ifdef FEATURE_SET
 	bool get_wifi_features;
 #endif
+#ifdef FEATURE_RUNTIME_PM
+	uint16_t cpu_cxpc_threshold;
+#endif
 };
 
 /**

+ 21 - 0
core/hdd/src/wlan_hdd_main.c

@@ -12423,6 +12423,26 @@ static void hdd_get_wifi_features_cfg_update(struct hdd_config *config,
 }
 #endif
 
+#ifdef FEATURE_RUNTIME_PM
+/**
+ * hdd_init_cpu_cxpc_threshold_cfg() - Initialize cpu cxpc threshold cfg
+ * @config: Pointer to HDD config
+ * @psoc: psoc pointer
+ *
+ * Return: None
+ */
+static void hdd_init_cpu_cxpc_threshold_cfg(struct hdd_config *config,
+					    struct wlan_objmgr_psoc *psoc)
+{
+	config->cpu_cxpc_threshold = cfg_get(psoc, CFG_CPU_CXPC_THRESHOLD);
+}
+#else
+static void hdd_init_cpu_cxpc_threshold_cfg(struct hdd_config *config,
+					    struct wlan_objmgr_psoc *psoc)
+{
+}
+#endif
+
 /**
  * hdd_cfg_params_init() - Initialize hdd params in hdd_config strucuture
  * @hdd_ctx - Pointer to HDD context
@@ -12546,6 +12566,7 @@ static void hdd_cfg_params_init(struct hdd_context *hdd_ctx)
 			cfg_get(psoc, CFG_READ_MAC_ADDR_FROM_MAC_FILE);
 
 	hdd_get_wifi_features_cfg_update(config, psoc);
+	hdd_init_cpu_cxpc_threshold_cfg(config, psoc);
 }
 
 #ifdef CONNECTION_ROAMING_CFG

+ 6 - 6
core/hdd/src/wlan_hdd_power.c

@@ -1189,10 +1189,10 @@ int wlan_hdd_ipv4_changed(struct notifier_block *nb,
  * CPU can enter CXPC mode.
  * The vote value is in microseconds.
  */
-#define HDD_CPU_CXPC_THRESHOLD (10000)
-static bool wlan_hdd_is_cpu_cxpc_allowed(unsigned long vote)
+static bool wlan_hdd_is_cpu_cxpc_allowed(struct hdd_context *hdd_ctx,
+					 unsigned long vote)
 {
-	if (vote >= HDD_CPU_CXPC_THRESHOLD)
+	if (vote >= hdd_ctx->config->cpu_cxpc_threshold)
 		return true;
 	else
 		return false;
@@ -1224,11 +1224,11 @@ int wlan_hdd_pm_qos_notify(struct notifier_block *nb, unsigned long curr_val,
 
 	if (!hdd_ctx->runtime_pm_prevented &&
 	    is_any_sta_connected &&
-	    !wlan_hdd_is_cpu_cxpc_allowed(curr_val)) {
+	    !wlan_hdd_is_cpu_cxpc_allowed(hdd_ctx, curr_val)) {
 		hif_rtpm_get(HIF_RTPM_GET_NORESUME, HIF_RTPM_ID_PM_QOS_NOTIFY);
 		hdd_ctx->runtime_pm_prevented = true;
 	} else if (hdd_ctx->runtime_pm_prevented &&
-		   wlan_hdd_is_cpu_cxpc_allowed(curr_val)) {
+		   wlan_hdd_is_cpu_cxpc_allowed(hdd_ctx, curr_val)) {
 		hif_rtpm_put(HIF_RTPM_PUT_NOIDLE, HIF_RTPM_ID_PM_QOS_NOTIFY);
 		hdd_ctx->runtime_pm_prevented = false;
 	}
@@ -1258,7 +1258,7 @@ bool wlan_hdd_is_cpu_pm_qos_in_progress(struct hdd_context *hdd_ctx)
 	curr_val_ns = cpuidle_governor_latency_req(max_cpu_num);
 	curr_val_us = curr_val_ns / NSEC_PER_USEC;
 	hdd_debug("PM QoS current value: %lld", curr_val_us);
-	if (!wlan_hdd_is_cpu_cxpc_allowed(curr_val_us))
+	if (!wlan_hdd_is_cpu_cxpc_allowed(hdd_ctx, curr_val_us))
 		return true;
 	else
 		return false;