Browse Source

qcacld-3.0: Set system suspend/resume state in hif ctx

Set system state in hif ctx to suspend or resume on
system suspend and resume respectively.

Change-Id: If1904a4fe5c861deed1b35071be10cb8cc8d6407
CRs-Fixed: 2899520
Yeshwanth Sriram Guntuka 4 years ago
parent
commit
43a40f83b0

+ 1 - 0
Kbuild

@@ -3408,6 +3408,7 @@ cppflags-y += -DDP_RX_DESC_COOKIE_INVALIDATE
 cppflags-y += -DMON_ENABLE_DROP_FOR_MAC
 cppflags-y += -DPCI_LINK_STATUS_SANITY
 cppflags-y += -DDP_MON_RSSI_IN_DBM
+cppflags-y += -DSYSTEM_PM_CHECK
 endif
 
 # Enable Low latency optimisation mode

+ 14 - 0
components/pmo/core/inc/wlan_pmo_suspend_resume.h

@@ -361,6 +361,20 @@ QDF_STATUS pmo_core_txrx_resume(struct wlan_objmgr_psoc *psoc);
  */
 QDF_STATUS pmo_core_config_forced_dtim(struct wlan_objmgr_vdev *vdev,
 				       uint32_t dynamic_dtim);
+
+#ifdef SYSTEM_PM_CHECK
+/**
+ * pmo_core_system_resume() - function to handle system resume notification
+ * @psoc: objmgr psoc handle
+ *
+ * Return: None
+ */
+void pmo_core_system_resume(struct wlan_objmgr_psoc *psoc);
+#else
+static inline void pmo_core_system_resume(struct wlan_objmgr_psoc *psoc)
+{
+}
+#endif
 #endif /* WLAN_POWER_MANAGEMENT_OFFLOAD */
 
 #endif /* end  of _WLAN_PMO_SUSPEND_RESUME_H_ */

+ 25 - 0
components/pmo/core/src/wlan_pmo_suspend_resume.c

@@ -1816,3 +1816,28 @@ out:
 	pmo_exit();
 	return status;
 }
+
+#ifdef SYSTEM_PM_CHECK
+void pmo_core_system_resume(struct wlan_objmgr_psoc *psoc)
+{
+	struct pmo_psoc_priv_obj *psoc_ctx;
+	QDF_STATUS status;
+
+	if (!psoc) {
+		pmo_err("psoc is NULL");
+		return;
+	}
+
+	status = pmo_psoc_get_ref(psoc);
+	if (status != QDF_STATUS_SUCCESS) {
+		pmo_err("pmo cannot get the reference out of psoc");
+		return;
+	}
+
+	psoc_ctx = pmo_psoc_get_priv(psoc);
+
+	htc_system_resume(psoc_ctx->htc_hdl);
+
+	pmo_psoc_put_ref(psoc);
+}
+#endif

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

@@ -2073,4 +2073,19 @@ 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);
 
+#ifdef SYSTEM_PM_CHECK
+/**
+ * ucfg_pmo_notify_system_resume() - system resume notification to pmo
+ * @psoc: pointer to psoc object
+ *
+ * Return: None
+ */
+void
+ucfg_pmo_notify_system_resume(struct wlan_objmgr_psoc *psoc);
+#else
+static inline
+void ucfg_pmo_notify_system_resume(struct wlan_objmgr_psoc *psoc)
+{
+}
+#endif
 #endif /* end  of _WLAN_PMO_UCFG_API_H_ */

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

@@ -919,3 +919,10 @@ QDF_STATUS ucfg_pmo_core_txrx_resume(struct wlan_objmgr_psoc *psoc)
 {
 	return pmo_core_txrx_resume(psoc);
 }
+
+#ifdef SYSTEM_PM_CHECK
+void ucfg_pmo_notify_system_resume(struct wlan_objmgr_psoc *psoc)
+{
+	pmo_core_system_resume(psoc);
+}
+#endif

+ 8 - 0
core/hdd/src/wlan_hdd_driver_ops.c

@@ -1208,6 +1208,8 @@ static int __wlan_hdd_bus_suspend(struct wow_enable_params wow_params,
 		goto late_hif_resume;
 	}
 
+	hif_system_pm_set_state_suspended(hif_ctx);
+
 	err = hif_bus_suspend(hif_ctx);
 	if (err) {
 		hdd_err("Failed hif bus suspend: %d", err);
@@ -1259,6 +1261,7 @@ late_hif_resume:
 resume_cdp:
 	status = cdp_bus_resume(dp_soc, OL_TXRX_PDEV_ID);
 	QDF_BUG(QDF_IS_STATUS_SUCCESS(status));
+	hif_system_pm_set_state_on(hif_ctx);
 
 	return err;
 }
@@ -1415,6 +1418,8 @@ int wlan_hdd_bus_resume(enum qdf_suspend_type type)
 		goto out;
 	}
 
+	hif_system_pm_set_state_resuming(hif_ctx);
+
 	qdf_status = ucfg_pmo_psoc_bus_resume_req(hdd_ctx->psoc,
 						  type);
 	status = qdf_status_to_os_return(qdf_status);
@@ -1423,6 +1428,8 @@ int wlan_hdd_bus_resume(enum qdf_suspend_type type)
 		goto out;
 	}
 
+	hif_system_pm_set_state_on(hif_ctx);
+
 	status = hif_bus_late_resume(hif_ctx);
 	if (status) {
 		hdd_err("Failed hif bus late resume");
@@ -1441,6 +1448,7 @@ int wlan_hdd_bus_resume(enum qdf_suspend_type type)
 	return 0;
 
 out:
+	hif_system_pm_set_state_suspended(hif_ctx);
 	if (cds_is_driver_recovering() || cds_is_driver_in_bad_state() ||
 		cds_is_fw_down())
 		return 0;

+ 2 - 0
core/hdd/src/wlan_hdd_power.c

@@ -1942,6 +1942,8 @@ static int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy)
 		}
 	}
 
+	ucfg_pmo_notify_system_resume(hdd_ctx->psoc);
+
 	qdf_mtrace(QDF_MODULE_ID_HDD, QDF_MODULE_ID_HDD,
 		   TRACE_CODE_HDD_CFG80211_RESUME_WLAN,
 		   NO_SESSION, hdd_ctx->is_wiphy_suspended);