ソースを参照

qcacld-3.0: Enable Runtime PM after first interface is up

Enable Runtime PM after first interface is up and disable it when
the last interface goes down. The current logic is enabling runtime
pm too early, causing crashes.

Change-Id: I486409bd8375de327b724fc16ab32b4907c1c093
CRs-Fixed: 1072520
Komal Seelam 8 年 前
コミット
f2136bb225
2 ファイル変更40 行追加4 行削除
  1. 0 4
      core/hdd/src/wlan_hdd_driver_ops.c
  2. 40 0
      core/hdd/src/wlan_hdd_main.c

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

@@ -266,8 +266,6 @@ int hdd_hif_open(struct device *dev, void *bdev, const hif_bus_id *bid,
 		}
 	}
 
-	hif_enable_power_management(hif_ctx, cds_is_packet_log_enabled());
-
 	return 0;
 
 err_hif_close:
@@ -287,8 +285,6 @@ void hdd_hif_close(void *hif_ctx)
 	if (hif_ctx == NULL)
 		return;
 
-	hif_disable_power_management(hif_ctx);
-
 	hif_disable(hif_ctx, HIF_DISABLE_TYPE_REMOVE);
 
 	hdd_napi_destroy(true);

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

@@ -1706,6 +1706,44 @@ err_start_adapter:
 	return -EINVAL;
 }
 
+/**
+ * hdd_enable_power_management() - API to Enable Power Management
+ *
+ * API invokes Bus Interface Layer power management functionality
+ *
+ * Return: None
+ */
+static void hdd_enable_power_management(void)
+{
+	void *hif_ctx = cds_get_context(QDF_MODULE_ID_HIF);
+
+	if (!hif_ctx) {
+		hdd_err("Bus Interface Context is Invalid");
+		return;
+	}
+
+	hif_enable_power_management(hif_ctx, cds_is_packet_log_enabled());
+}
+
+/**
+ * hdd_disable_power_management() - API to disable Power Management
+ *
+ * API disable Bus Interface Layer Power management functionality
+ *
+ * Return: None
+ */
+static void hdd_disable_power_management(void)
+{
+	void *hif_ctx = cds_get_context(QDF_MODULE_ID_HIF);
+
+	if (!hif_ctx) {
+		hdd_err("Bus Interface Context is Invalid");
+		return;
+	}
+
+	hif_disable_power_management(hif_ctx);
+}
+
 /**
  * hdd_wlan_start_modules() - Single driver state machine for starting modules
  * @hdd_ctx: HDD context
@@ -1835,6 +1873,7 @@ int hdd_wlan_start_modules(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter,
 			hdd_err("Failed to Enable cds modules");
 			goto close;
 		}
+		hdd_enable_power_management();
 		hdd_info("Driver Modules Successfully Enabled");
 		hdd_ctx->driver_status = DRIVER_MODULES_ENABLED;
 		break;
@@ -7601,6 +7640,7 @@ int hdd_wlan_stop_modules(hdd_context_t *hdd_ctx, bool shutdown)
 		hdd_info("Modules already closed");
 		goto done;
 	case DRIVER_MODULES_ENABLED:
+		hdd_disable_power_management();
 		if (hdd_deconfigure_cds(hdd_ctx)) {
 			hdd_alert("Failed to de-configure CDS");
 			QDF_ASSERT(0);