Browse Source

qcacld-3.0: Add new ini to config suspend mode

Sometimes we need PDEV suspend mode, WMI_PDEV_SUSPEND_CMDID and
WMI_PDEV_RESUME_CMDID. But currently design, only support WoW
suspend or not support two choices. And, there are two confused
ini configuration, gDisableWow and gEnableWoW.

1. Add new ini gSuspendMode to set suspend mode. Default 2.
	0, does not support suspend
	1, legency pdev suspend mode
	2, WoW suspend mode
2. Clean gDisableWow. It is replaced by gSuspendMode=0.
   HDD suspend/resume function get the value by new API
   ucfg_pmo_get_suspend_mode().

Change-Id: Icbeef3df6879ca2054f64e0292e9b9469c4936d4
CRs-fixed: 2940788
Yu Ouyang 3 years ago
parent
commit
1a3b66cbdd

+ 1 - 0
components/pmo/core/src/wlan_pmo_main.c

@@ -244,6 +244,7 @@ static void wlan_pmo_init_cfg(struct wlan_objmgr_psoc *psoc,
 	psoc_cfg->max_ps_poll = cfg_get(psoc, CFG_PMO_MAX_PS_POLL);
 
 	psoc_cfg->wow_enable = cfg_get(psoc, CFG_PMO_WOW_ENABLE);
+	psoc_cfg->suspend_mode = cfg_get(psoc, CFG_PMO_SUSPEND_MODE);
 
 	wlan_extwow_init_cfg(psoc, psoc_cfg);
 	psoc_cfg->apf_enable = cfg_get(psoc, CFG_PMO_APF_ENABLE);

+ 2 - 1
components/pmo/core/src/wlan_pmo_suspend_resume.c

@@ -487,7 +487,8 @@ static QDF_STATUS pmo_core_psoc_configure_suspend(struct wlan_objmgr_psoc *psoc,
 	if (is_runtime_pm)
 		pmo_core_enable_runtime_pm_offloads(psoc);
 
-	if (pmo_core_is_wow_applicable(psoc)) {
+	if (psoc_ctx->psoc_cfg.suspend_mode == PMO_SUSPEND_WOW &&
+	    pmo_core_is_wow_applicable(psoc)) {
 		pmo_debug("WOW Suspend");
 		pmo_core_apply_lphb(psoc);
 		/*

+ 26 - 0
components/pmo/dispatcher/inc/wlan_pmo_common_cfg.h

@@ -334,6 +334,31 @@
 					CFG_VALUE_OR_DEFAULT, \
 					"Enable WoW Support")
 
+/*
+ * <ini>
+ * gSuspendMode - Suspend mode configuration
+ * @Min: 0
+ * @Max: 2
+ * @Default: 2
+ *
+ * This ini is used to set suspend mode. Configurations are as follows:
+ * 0 - Does not support suspend.
+ * 1 - Legency suspend mode, PDEV suspend.
+ * 2 - WOW suspend mode.
+ *
+ * Related: None
+ *
+ * Supported Feature: Power Save
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_PMO_SUSPEND_MODE CFG_INI_UINT("gSuspendMode", \
+					  0, 2, 2, \
+					  CFG_VALUE_OR_DEFAULT, \
+					  "Suspend mode")
+
 /*
  * <ini>
  * gActiveModeOffload - Active offload mode configuration
@@ -535,6 +560,7 @@
 	CFG(CFG_PMO_POWERSAVE_MODE) \
 	CFG(CFG_PMO_MAX_PS_POLL) \
 	CFG(CFG_PMO_WOW_ENABLE) \
+	CFG(CFG_PMO_SUSPEND_MODE) \
 	CFG(CFG_PMO_ACTIVE_MODE) \
 	CFG(CFG_PMO_PWR_FAILURE) \
 	CFG(CFG_PMO_WOW_DATA_INACTIVITY_TIMEOUT) \

+ 14 - 0
components/pmo/dispatcher/inc/wlan_pmo_common_public_struct.h

@@ -167,6 +167,18 @@ enum powersave_mode {
 	PMO_PS_ADVANCED_POWER_SAVE_ENABLE = 1
 };
 
+/**
+ * enum pmo_suspend_mode - suspend_mode
+ * @PMO_SUSPEND_NONE: Does not support suspend
+ * @PMO_SUSPEND_LEGENCY: Legency PDEV suspend mode
+ * @PMO_SUSPEND_WOW: WoW suspend mode
+ */
+enum pmo_suspend_mode {
+	PMO_SUSPEND_NONE = 0,
+	PMO_SUSPEND_LEGENCY,
+	PMO_SUSPEND_WOW
+};
+
 #define PMO_TARGET_SUSPEND_TIMEOUT   (4000)
 #define PMO_WAKE_LOCK_TIMEOUT        1000
 #define PMO_RESUME_TIMEOUT           (4000)
@@ -299,6 +311,7 @@ enum pmo_gpio_wakeup_mode {
  * @sta_forced_dtim: station forced DTIM value
  * @wow_enable: enable wow with majic pattern match or pattern byte match
  * @power_save_mode: power save mode for psoc
+ * @suspend_mode: suspend mode for psoc
  * @runtime_pm_delay: set runtime pm's inactivity timer
  * @extwow_goto_suspend: true when extended WoW enabled else false
  * @extwow_app1_wakeup_pin_num: set wakeup1 PIN number
@@ -363,6 +376,7 @@ struct pmo_psoc_cfg {
 	enum pmo_wow_enable_type wow_enable;
 	enum powersave_mode power_save_mode;
 	enum powersave_mode default_power_save_mode;
+	enum pmo_suspend_mode suspend_mode;
 #ifdef FEATURE_RUNTIME_PM
 	uint32_t runtime_pm_delay;
 #endif

+ 9 - 0
components/pmo/dispatcher/inc/wlan_pmo_ucfg_api.h

@@ -2135,6 +2135,15 @@ ucfg_pmo_get_sap_mode_bus_suspend(struct wlan_objmgr_psoc *psoc);
 bool
 ucfg_pmo_get_go_mode_bus_suspend(struct wlan_objmgr_psoc *psoc);
 
+/**
+ * ucfg_pmo_get_suspend_mode - Return pmo_suspend_mode value to caller
+ * @psoc: Pointer to psoc object
+ *
+ * Return: The value of suspend_mode as stored in CFG
+ */
+enum pmo_suspend_mode
+ucfg_pmo_get_suspend_mode(struct wlan_objmgr_psoc *psoc);
+
 #ifdef SYSTEM_PM_CHECK
 /**
  * ucfg_pmo_notify_system_resume() - system resume notification to pmo

+ 8 - 0
components/pmo/dispatcher/src/wlan_pmo_ucfg_api.c

@@ -939,6 +939,14 @@ ucfg_pmo_get_go_mode_bus_suspend(struct wlan_objmgr_psoc *psoc)
 	return pmo_psoc_ctx->psoc_cfg.is_bus_suspend_enabled_in_go_mode;
 }
 
+enum pmo_suspend_mode
+ucfg_pmo_get_suspend_mode(struct wlan_objmgr_psoc *psoc)
+{
+	struct pmo_psoc_priv_obj *pmo_psoc_ctx = pmo_psoc_get_priv(psoc);
+
+	return pmo_psoc_ctx->psoc_cfg.suspend_mode;
+}
+
 QDF_STATUS ucfg_pmo_core_txrx_suspend(struct wlan_objmgr_psoc *psoc)
 {
 	return pmo_core_txrx_suspend(psoc);

+ 0 - 25
core/hdd/inc/hdd_config.h

@@ -1490,30 +1490,6 @@ struct dhcp_server {
 			0, \
 			"Enable/Disable conversion from SARV1 to SARV2")
 
-/*
- * <ini>
- * gDisableWow - Used to disable wow feature
- *
- * @Min: 0
- * @Max: 1
- * Default: 0
- *
- * This ini is used to disable wow feature for all modes
- * that means hlos platform suspend(cfg80211 suspend) will
- * be rejected by wifi kernel driver.
- *
- * Usage: External
- *
- * </ini>
- */
-#define CFG_WOW_DISABLE  CFG_INI_UINT( \
-			"gDisableWow", \
-			0, \
-			1, \
-			0, \
-			CFG_VALUE_OR_DEFAULT, \
-			"Disable wow feature")
-
 /*
  * <ini>
  * nb_commands_interval - Used to rate limit nb commands from userspace
@@ -1816,7 +1792,6 @@ enum host_log_level {
 	CFG(CFG_ENABLE_DISABLE_CHANNEL) \
 	CFG(CFG_READ_MAC_ADDR_FROM_MAC_FILE) \
 	CFG(CFG_SAR_CONVERSION) \
-	CFG(CFG_WOW_DISABLE) \
 	CFG(CFG_ENABLE_HOST_MODULE_LOG_LEVEL) \
 	SAR_SAFETY_FEATURE_ALL
 #endif

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

@@ -229,7 +229,6 @@ struct hdd_config {
 	uint32_t derived_intf_pool;
 	uint32_t cfg_wmi_credit_cnt;
 	uint32_t enable_sar_conversion;
-	bool is_wow_disabled;
 #ifdef WLAN_FEATURE_TSF_PLUS
 	uint8_t tsf_ptp_options;
 #endif /* WLAN_FEATURE_TSF_PLUS */

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

@@ -12602,7 +12602,6 @@ static void hdd_cfg_params_init(struct hdd_context *hdd_ctx)
 			cfg_get(psoc, CFG_ENABLE_UNIT_TEST_FRAMEWORK);
 	config->disable_channel = cfg_get(psoc, CFG_ENABLE_DISABLE_CHANNEL);
 	config->enable_sar_conversion = cfg_get(psoc, CFG_SAR_CONVERSION);
-	config->is_wow_disabled = cfg_get(psoc, CFG_WOW_DISABLE);
 	config->nb_commands_interval =
 				cfg_get(psoc, CFG_NB_COMMANDS_RATE_LIMIT);
 

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

@@ -2036,8 +2036,8 @@ static int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy)
 		goto exit_with_code;
 	}
 
-	if (hdd_ctx->config->is_wow_disabled) {
-		hdd_err("wow is disabled");
+	if (ucfg_pmo_get_suspend_mode(hdd_ctx->psoc) == PMO_SUSPEND_NONE) {
+		hdd_info_rl("Suspend is not supported");
 		return -EINVAL;
 	}
 
@@ -2206,8 +2206,8 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy,
 	if (0 != rc)
 		return rc;
 
-	if (hdd_ctx->config->is_wow_disabled) {
-		hdd_info_rl("wow is disabled");
+	if (ucfg_pmo_get_suspend_mode(hdd_ctx->psoc) == PMO_SUSPEND_NONE) {
+		hdd_info_rl("Suspend is not supported");
 		return -EINVAL;
 	}