summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKomal Seelam <kseelam@codeaurora.org>2016-09-28 18:30:44 +0530
committerqcabuildsw <qcabuildsw@localhost>2016-10-05 03:59:07 -0700
commitf2136bb225a530f18af7a010a8b5ab85a930b9d1 (patch)
tree32da528c4f2fba9b45a4d8c97b0829499cb78b85
parenta6b5859c3bb12504b6560150e6b1210ffbb809f1 (diff)
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
-rw-r--r--core/hdd/src/wlan_hdd_driver_ops.c4
-rw-r--r--core/hdd/src/wlan_hdd_main.c40
2 files changed, 40 insertions, 4 deletions
diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c
index 3a8a06dc156a..a20fcb7b7836 100644
--- a/core/hdd/src/wlan_hdd_driver_ops.c
+++ b/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);
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index 356c86841843..82be6b96f3f3 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -1707,6 +1707,44 @@ err_start_adapter:
}
/**
+ * 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
* @adapter: HDD adapter
@@ -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);