From f2136bb225a530f18af7a010a8b5ab85a930b9d1 Mon Sep 17 00:00:00 2001 From: Komal Seelam Date: Wed, 28 Sep 2016 18:30:44 +0530 Subject: [PATCH] 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 --- core/hdd/src/wlan_hdd_driver_ops.c | 4 --- core/hdd/src/wlan_hdd_main.c | 40 ++++++++++++++++++++++++++++++ 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 @@ -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);