Jelajahi Sumber

qcacld-3.0: Add change to support DRV during wow mode

Add changes to support DRV feature during wow mode.

Change-Id: I588dfc5fa1bc419a288f346664c4028ef2d2011b
CRs-Fixed: 2456148
Rajeev Kumar 5 tahun lalu
induk
melakukan
c58f7c2578

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

@@ -745,6 +745,13 @@ pmo_core_enable_wow_in_fw(struct wlan_objmgr_psoc *psoc,
 		psoc_ctx->wow.wow_state = pmo_wow_state_unified_d0;
 	}
 
+	if (qdf_is_drv_connected()) {
+		pmo_info("drv wow is enabled");
+		param.flags |= WMI_WOW_FLAG_ENABLE_DRV_PCIE_L1SS_SLEEP;
+	} else {
+		pmo_info("non-drv wow is enabled");
+	}
+
 	status = pmo_tgt_psoc_send_wow_enable_req(psoc, &param);
 	if (status != QDF_STATUS_SUCCESS) {
 		pmo_err("Failed to enable wow in fw");

+ 16 - 0
core/cds/src/cds_api.c

@@ -176,6 +176,21 @@ uint8_t cds_get_datapath_handles(void **soc, struct cdp_pdev **pdev,
 	return 0;
 }
 
+static bool cds_is_drv_connected(void)
+{
+	int ret;
+	qdf_device_t qdf_ctx;
+
+	qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
+	if (!qdf_ctx) {
+		cds_err("cds context is invalid");
+		return false;
+	}
+
+	ret = pld_is_drv_connected(qdf_ctx->dev);
+
+	return ((ret > 0) ? true : false);
+}
 
 QDF_STATUS cds_init(void)
 {
@@ -196,6 +211,7 @@ QDF_STATUS cds_init(void)
 	qdf_register_self_recovery_callback(__cds_trigger_recovery);
 	qdf_register_fw_down_callback(cds_is_fw_down);
 	qdf_register_recovering_state_query_callback(cds_is_driver_recovering);
+	qdf_register_drv_connected_callback(cds_is_drv_connected);
 
 	return QDF_STATUS_SUCCESS;
 

+ 1 - 0
core/wma/inc/wma.h

@@ -1138,6 +1138,7 @@ typedef struct {
 					uint8_t vdev_id);
 	qdf_wake_lock_t wmi_cmd_rsp_wake_lock;
 	qdf_runtime_lock_t wmi_cmd_rsp_runtime_lock;
+	qdf_runtime_lock_t sap_prevent_runtime_pm_lock;
 	enum active_apf_mode active_uc_apf_mode;
 	enum active_apf_mode active_mc_bc_apf_mode;
 	struct wma_ini_config ini_config;

+ 24 - 2
core/wma/src/wma_dev_if.c

@@ -5801,6 +5801,16 @@ static void wma_delete_sta_req_sta_mode(tp_wma_handle wma,
 	}
 }
 
+static void wma_sap_prevent_runtime_pm(tp_wma_handle wma)
+{
+	qdf_runtime_pm_prevent_suspend(&wma->sap_prevent_runtime_pm_lock);
+}
+
+static void wma_sap_allow_runtime_pm(tp_wma_handle wma)
+{
+	qdf_runtime_pm_allow_suspend(&wma->sap_prevent_runtime_pm_lock);
+}
+
 /**
  * wma_add_sta() - process add sta request as per opmode
  * @wma: wma handle
@@ -5840,7 +5850,13 @@ void wma_add_sta(tp_wma_handle wma, tpAddStaParams add_sta)
 	/* IBSS should share the same code as AP mode */
 	case BSS_OPERATIONAL_MODE_IBSS:
 	case BSS_OPERATIONAL_MODE_AP:
-		htc_vote_link_up(htc_handle);
+		if (qdf_is_drv_connected()) {
+			wma_debug("drv wow enabled prevent runtime pm");
+			wma_sap_prevent_runtime_pm(wma);
+		} else {
+			wma_debug("non-drv wow enabled vote for link up");
+			htc_vote_link_up(htc_handle);
+		}
 		wma_add_sta_req_ap_mode(wma, add_sta);
 		break;
 	case BSS_OPERATIONAL_MODE_NDI:
@@ -5907,7 +5923,13 @@ void wma_delete_sta(tp_wma_handle wma, tpDeleteStaParams del_sta)
 
 	case BSS_OPERATIONAL_MODE_IBSS: /* IBSS shares AP code */
 	case BSS_OPERATIONAL_MODE_AP:
-		htc_vote_link_down(htc_handle);
+		if (qdf_is_drv_connected()) {
+			wma_debug("drv wow enabled allow runtime pm");
+			wma_sap_allow_runtime_pm(wma);
+		} else {
+			wma_debug("drv wow disabled vote for link down");
+			htc_vote_link_down(htc_handle);
+		}
 		wma_delete_sta_req_ap_mode(wma, del_sta);
 		/* free the memory here only if sync feature is not enabled */
 		if (!rsp_requested &&

+ 3 - 0
core/wma/src/wma_main.c

@@ -3599,6 +3599,7 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc,
 	qdf_wake_lock_create(&wma_handle->wmi_cmd_rsp_wake_lock,
 					"wlan_fw_rsp_wakelock");
 	qdf_runtime_lock_init(&wma_handle->wmi_cmd_rsp_runtime_lock);
+	qdf_runtime_lock_init(&wma_handle->sap_prevent_runtime_pm_lock);
 
 	/* Register peer assoc conf event handler */
 	wmi_unified_register_event_handler(wma_handle->wmi_handle,
@@ -3698,6 +3699,7 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc,
 
 err_dbglog_init:
 	qdf_wake_lock_destroy(&wma_handle->wmi_cmd_rsp_wake_lock);
+	qdf_runtime_lock_deinit(&wma_handle->sap_prevent_runtime_pm_lock);
 	qdf_runtime_lock_deinit(&wma_handle->wmi_cmd_rsp_runtime_lock);
 	qdf_spinlock_destroy(&wma_handle->vdev_respq_lock);
 	qdf_spinlock_destroy(&wma_handle->wma_hold_req_q_lock);
@@ -4773,6 +4775,7 @@ QDF_STATUS wma_close(void)
 	wma_cleanup_vdev_resp_queue(wma_handle);
 	wma_cleanup_hold_req(wma_handle);
 	qdf_wake_lock_destroy(&wma_handle->wmi_cmd_rsp_wake_lock);
+	qdf_runtime_lock_deinit(&wma_handle->sap_prevent_runtime_pm_lock);
 	qdf_runtime_lock_deinit(&wma_handle->wmi_cmd_rsp_runtime_lock);
 	qdf_spinlock_destroy(&wma_handle->vdev_respq_lock);
 	qdf_spinlock_destroy(&wma_handle->wma_hold_req_q_lock);