ソースを参照

qcacld-3.0: Disable Runtime PM when scan in progress

scan request and responses are async. So prevent runtime pm
till scan is completed.

Change-Id: I48dc835c0720213e2bc6e69f4dc5dd9eb084dd4a
CRs-Fixed: 1072520
Komal Seelam 8 年 前
コミット
8634b7772e
3 ファイル変更45 行追加1 行削除
  1. 11 1
      core/hdd/inc/wlan_hdd_main.h
  2. 31 0
      core/hdd/src/wlan_hdd_main.c
  3. 3 0
      core/hdd/src/wlan_hdd_scan.c

+ 11 - 1
core/hdd/inc/wlan_hdd_main.h

@@ -854,6 +854,16 @@ struct hdd_chan_change_params {
 	struct ch_params_s chan_params;
 };
 
+/**
+ * struct hdd_runtime_pm_context - context to prevent/allow runtime pm
+ * @scan: scan context to prvent/allow runtime pm
+ *
+ * Prevent Runtime PM for scan
+ */
+struct hdd_runtime_pm_context {
+	qdf_runtime_lock_t scan;
+};
+
 /**
  * struct hdd_connect_pm_context - Runtime PM connect context per adapter
  * @connect: Runtime Connect Context
@@ -1537,9 +1547,9 @@ struct hdd_context_s {
 	bool update_mac_addr_to_fw;
 	struct acs_dfs_policy acs_policy;
 	uint16_t wmi_max_len;
-
 	/* counters for failed suspend reasons */
 	uint32_t suspend_fail_stats[SUSPEND_FAIL_MAX_COUNT];
+	struct hdd_runtime_pm_context runtime_context;
 };
 
 /*---------------------------------------------------------------------------

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

@@ -2452,6 +2452,33 @@ void hdd_set_station_ops(struct net_device *pWlanDev)
 }
 
 #ifdef FEATURE_RUNTIME_PM
+/**
+ * hdd_runtime_suspend_context_init() - API to initialize HDD Runtime Contexts
+ * @hdd_ctx: HDD context
+ *
+ * Return: None
+ */
+static void hdd_runtime_suspend_context_init(hdd_context_t *hdd_ctx)
+{
+	struct hdd_runtime_pm_context *ctx = &hdd_ctx->runtime_context;
+
+	ctx->scan = qdf_runtime_lock_init("scan");
+}
+
+/**
+ * hdd_runtime_suspend_context_deinit() - API to deinit HDD runtime context
+ * @hdd_ctx: HDD Context
+ *
+ * Return: None
+ */
+static void hdd_runtime_suspend_context_deinit(hdd_context_t *hdd_ctx)
+{
+	struct hdd_runtime_pm_context *ctx = &hdd_ctx->runtime_context;
+
+	qdf_runtime_lock_deinit(ctx->scan);
+	ctx->scan = NULL;
+}
+
 static void hdd_adapter_runtime_suspend_init(hdd_adapter_t *adapter)
 {
 	struct hdd_connect_pm_context *ctx = &adapter->connect_rpm_ctx;
@@ -2467,6 +2494,8 @@ static void hdd_adapter_runtime_suspend_denit(hdd_adapter_t *adapter)
 	ctx->connect = NULL;
 }
 #else /* FEATURE_RUNTIME_PM */
+static void hdd_runtime_suspend_context_init(hdd_context_t *hdd_ctx) {}
+static void hdd_runtime_suspend_context_deinit(hdd_context_t *hdd_ctx) {}
 static inline void hdd_adapter_runtime_suspend_init(hdd_adapter_t *adapter) {}
 static inline void hdd_adapter_runtime_suspend_denit(hdd_adapter_t *adapter) {}
 #endif /* FEATURE_RUNTIME_PM */
@@ -4842,6 +4871,7 @@ static void hdd_wlan_exit(hdd_context_t *hdd_ctx)
 
 	hdd_green_ap_deinit(hdd_ctx);
 
+	hdd_runtime_suspend_context_deinit(hdd_ctx);
 	hdd_close_all_adapters(hdd_ctx, false);
 
 	hdd_ipa_cleanup(hdd_ctx);
@@ -8031,6 +8061,7 @@ int hdd_wlan_startup(struct device *dev)
 	if (QDF_IS_STATUS_ERROR(status))
 		goto err_debugfs_exit;
 
+	hdd_runtime_suspend_context_init(hdd_ctx);
 	memdump_init();
 	hdd_driver_memdump_init();
 

+ 3 - 0
core/hdd/src/wlan_hdd_scan.c

@@ -1242,6 +1242,7 @@ static QDF_STATUS hdd_cfg80211_scan_done_callback(tHalHandle halHandle,
 		hdd_vendor_scan_callback(pAdapter, req, aborted);
 
 allow_suspend:
+	qdf_runtime_pm_allow_suspend(hddctx->runtime_context.scan);
 	qdf_spin_lock(&hddctx->hdd_scan_req_q_lock);
 	size = qdf_list_size(&hddctx->hdd_scan_req_q);
 	if (!size) {
@@ -1732,6 +1733,7 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
 	if (request->flags & NL80211_SCAN_FLAG_FLUSH)
 		sme_scan_flush_result(WLAN_HDD_GET_HAL_CTX(pAdapter));
 #endif
+	qdf_runtime_pm_prevent_suspend(pHddCtx->runtime_context.scan);
 	status = sme_scan_request(WLAN_HDD_GET_HAL_CTX(pAdapter),
 				pAdapter->sessionId, &scan_req,
 				&hdd_cfg80211_scan_done_callback, dev);
@@ -1745,6 +1747,7 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
 			status = -EIO;
 		}
 
+		qdf_runtime_pm_allow_suspend(pHddCtx->runtime_context.scan);
 		hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN);
 		goto free_mem;
 	}