Browse Source

qcacld-3.0: Add runtime pm ini items

Add runtime pm enable and delay ini items in hdd.
If runtime pm isn't enabled, the wlan driver will
not perform runtime suspends.
If runtime pm is enabled, the wlan driver will
perform a runtime suspend after delay time in
miliseconds.

Change-Id: I7fa05b9fc1e81bd189e8336efcb3d2977732ed81
CRs-Fixed: 935300
Houston Hoffman 9 years ago
parent
commit
c7c69f014d
3 changed files with 83 additions and 0 deletions
  1. 28 0
      core/hdd/inc/wlan_hdd_cfg.h
  2. 33 0
      core/hdd/src/wlan_hdd_cfg.c
  3. 22 0
      core/hdd/src/wlan_hdd_main.c

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

@@ -1009,6 +1009,28 @@ typedef enum {
 #define CFG_ENABLE_HOST_SSDP_MAX               (1)
 #define CFG_ENABLE_HOST_SSDP_DEFAULT           (1)
 
+#ifdef FEATURE_RUNTIME_PM
+/*
+ * config item to enable runtime suspend
+ * 1 means runtime suspend is enabled
+ * by default runtime suspend is disabled
+ */
+#define CFG_ENABLE_RUNTIME_PM                  "gRuntimePM"
+#define CFG_ENABLE_RUNTIME_PM_MIN              (0)
+#define CFG_ENABLE_RUNTIME_PM_MAX              (1)
+#define CFG_ENABLE_RUNTIME_PM_DEFAULT          (0)
+
+/*
+ * config item for runtime pm's inactivity timer.
+ * the wlan driver will wait for this number of miliseconds
+ * of inactivity before performing a runtime suspend.
+ */
+#define CFG_RUNTIME_PM_DELAY_NAME               "gRuntimePMDelay"
+#define CFG_RUNTIME_PM_DELAY_MIN                (100)
+#define CFG_RUNTIME_PM_DELAY_MAX                (10000)
+#define CFG_RUNTIME_PM_DELAY_DEFAULT            (500)
+#endif
+
 #define CFG_ENABLE_HOST_NSOFFLOAD_NAME         "hostNSOffload"
 #define CFG_ENABLE_HOST_NSOFFLOAD_MIN          (0)
 #define CFG_ENABLE_HOST_NSOFFLOAD_MAX          (1)
@@ -3070,6 +3092,12 @@ struct hdd_config {
 	uint8_t mcastBcastFilterSetting;
 	bool fhostArpOffload;
 	bool ssdp;
+
+#ifdef FEATURE_RUNTIME_PM
+	bool runtime_pm;
+	uint32_t runtime_pm_delay;
+#endif
+
 #ifdef FEATURE_WLAN_RA_FILTERING
 	bool IsRArateLimitEnabled;
 	uint16_t RArateLimitInterval;

+ 33 - 0
core/hdd/src/wlan_hdd_cfg.c

@@ -1568,6 +1568,23 @@ REG_TABLE_ENTRY g_registry_table[] = {
 		     CFG_ENABLE_HOST_SSDP_MIN,
 		     CFG_ENABLE_HOST_SSDP_MAX),
 
+#ifdef FEATURE_RUNTIME_PM
+	REG_VARIABLE(CFG_ENABLE_RUNTIME_PM, WLAN_PARAM_Integer,
+		     struct hdd_config, runtime_pm,
+		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+		     CFG_ENABLE_RUNTIME_PM_DEFAULT,
+		     CFG_ENABLE_RUNTIME_PM_MIN,
+		     CFG_ENABLE_RUNTIME_PM_MAX),
+
+	REG_VARIABLE(CFG_RUNTIME_PM_DELAY_NAME, WLAN_PARAM_Integer,
+		     struct hdd_config, runtime_pm_delay,
+		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+		     CFG_RUNTIME_PM_DELAY_DEFAULT,
+		     CFG_RUNTIME_PM_DELAY_MIN,
+		     CFG_RUNTIME_PM_DELAY_MAX),
+#endif
+
+
 	REG_VARIABLE(CFG_ENABLE_HOST_NSOFFLOAD_NAME, WLAN_PARAM_Integer,
 		     struct hdd_config, fhostNSOffload,
 		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
@@ -4489,6 +4506,21 @@ static void hdd_set_power_save_offload_config(hdd_context_t *pHddCtx)
 
 }
 
+#ifdef FEATURE_RUNTIME_PM
+static void hdd_cfg_print_runtime_pm(hdd_context_t *hdd_ctx)
+{
+	hdd_info("Name = [gRuntimePM] Value = [%u] ",
+		 hdd_ctx->config->runtime_pm);
+
+	hdd_info("Name = [gRuntimePMDelay] Value = [%u] ",
+		 hdd_ctx->config->runtime_pm_delay);
+}
+#else
+static void hdd_cfg_print_runtime_pm(hdd_context_t *hdd_ctx)
+{
+}
+#endif
+
 /**
  * hdd_cfg_print() - print the hdd configuration
  * @iniTable: pointer to hdd context
@@ -4758,6 +4790,7 @@ void hdd_cfg_print(hdd_context_t *pHddCtx)
 		  pHddCtx->config->fhostArpOffload);
 	QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO_HIGH,
 		  "Name = [ssdp] Value = [%u] ", pHddCtx->config->ssdp);
+	hdd_cfg_print_runtime_pm(pHddCtx);
 #ifdef FEATURE_WLAN_RA_FILTERING
 	QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO_HIGH,
 		  "Name = [RArateLimitInterval] Value = [%u] ",

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

@@ -7005,6 +7005,27 @@ static void hdd_update_ol_config(hdd_context_t *hdd_ctx)
 	ol_init_ini_config(ol_ctx, &cfg);
 }
 
+#ifdef FEATURE_RUNTIME_PM
+/**
+ * hdd_populate_runtime_cfg() - populate runtime configuration
+ * @hdd_ctx: hdd context
+ * @cfg: pointer to the configuration memory being populated
+ *
+ * Return: void
+ */
+static void hdd_populate_runtime_cfg(hdd_context_t *hdd_ctx,
+				     struct hif_config_info *cfg)
+{
+	cfg->enable_runtime_pm = hdd_ctx->config->runtime_pm;
+	cfg->runtime_pm_delay = hdd_ctx->config->runtime_pm_delay;
+}
+#else
+static void hdd_populate_runtime_cfg(hdd_context_t *hdd_ctx,
+				     struct hif_config_info *cfg)
+{
+}
+#endif
+
 /**
  * hdd_update_hif_config - API to update HIF configuration parameters
  * @hdd_ctx: HDD Context
@@ -7020,6 +7041,7 @@ static void hdd_update_hif_config(hdd_context_t *hdd_ctx)
 		return;
 
 	cfg.enable_self_recovery = hdd_ctx->config->enableSelfRecovery;
+	hdd_populate_runtime_cfg(hdd_ctx, &cfg);
 	hif_init_ini_config(scn, &cfg);
 }