From 7d7f50849da8fda05afa36368d9594f7a5f50c12 Mon Sep 17 00:00:00 2001 From: Vevek Venkatesan Date: Fri, 12 Jun 2020 23:21:56 +0530 Subject: [PATCH] qcacld-3.0: add Runtime PM support and its PLD callbacks Add PLD functions for Runtime suspend and resume callbacks, and enable Runtime PM support for Moselle. Change-Id: Ie990334c0c60892ec0f0ad6fac3253b3d326a919 CRs-Fixed: 2720832 --- configs/default_defconfig | 4 ++++ core/pld/src/pld_ipci.c | 49 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/configs/default_defconfig b/configs/default_defconfig index 2b2349f4fa8a..6da6d5103233 100644 --- a/configs/default_defconfig +++ b/configs/default_defconfig @@ -486,6 +486,10 @@ ifeq ($(CONFIG_CNSS_QCA6750), y) CONFIG_FEATURE_HAL_DELAYED_REG_WRITE := n endif +ifeq ($(CONFIG_CNSS_QCA6750), y) + CONFIG_BUS_AUTO_SUSPEND := y +endif + CONFIG_QCA_WIFI_QCA8074 := y CONFIG_QCA_WIFI_QCA8074_VP := y CONFIG_DP_INTR_POLL_BASED := y diff --git a/core/pld/src/pld_ipci.c b/core/pld/src/pld_ipci.c index 83f4435dfe3c..15c0208f5e38 100644 --- a/core/pld/src/pld_ipci.c +++ b/core/pld/src/pld_ipci.c @@ -240,6 +240,53 @@ static int pld_ipci_resume_noirq(struct device *dev) return 0; } +/** + * pld_ipci_runtime_suspend() - Runtime suspend callback for power management + * @dev: device + * + * This function is to runtime suspend the platform device when power management + * is enabled. + * + * Return: status + */ +static int pld_ipci_runtime_suspend(struct device *dev) +{ + struct pld_context *pld_context; + + pld_context = pld_get_global_context(); + if (!pld_context) + return -EINVAL; + + if (pld_context->ops && pld_context->ops->runtime_suspend) + return pld_context->ops->runtime_suspend(dev, + PLD_BUS_TYPE_IPCI); + + return 0; +} + +/** + * pld_ipci_runtime_resume() - Runtime resume callback for power management + * @pdev: device + * + * This function is to runtime resume the platform device when power management + * is enabled. + * + * Return: status + */ +static int pld_ipci_runtime_resume(struct device *dev) +{ + struct pld_context *pld_context; + + pld_context = pld_get_global_context(); + if (!pld_context) + return -EINVAL; + + if (pld_context->ops && pld_context->ops->runtime_resume) + return pld_context->ops->runtime_resume(dev, PLD_BUS_TYPE_IPCI); + + return 0; +} + static int pld_ipci_uevent(struct device *dev, struct icnss_uevent_data *uevent) { @@ -343,6 +390,8 @@ struct icnss_driver_ops pld_ipci_ops = { .pm_resume = pld_ipci_pm_resume, .suspend_noirq = pld_ipci_suspend_noirq, .resume_noirq = pld_ipci_resume_noirq, + .runtime_suspend = pld_ipci_runtime_suspend, + .runtime_resume = pld_ipci_runtime_resume, .uevent = pld_ipci_uevent, .idle_restart = pld_ipci_idle_restart_cb, .idle_shutdown = pld_ipci_idle_shutdown_cb,