summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);