[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <1410533779-3310-2-git-send-email-k.kozlowski@samsung.com>
Date: Fri, 12 Sep 2014 16:56:18 +0200
From: Krzysztof Kozlowski <k.kozlowski@...sung.com>
To: Russell King <linux@....linux.org.uk>,
Dan Williams <dan.j.williams@...el.com>,
Vinod Koul <vinod.koul@...el.com>,
linux-kernel@...r.kernel.org, dmaengine@...r.kernel.org,
Ulf Hansson <ulf.hansson@...aro.org>,
Grant Likely <grant.likely@...aro.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Michal Simek <michal.simek@...inx.com>
Cc: Kyungmin Park <kyungmin.park@...sung.com>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
Krzysztof Kozlowski <k.kozlowski@...sung.com>
Subject: [RFC PATCH v2 1/2] amba: Allow AMBA drivers to use their own runtime PM
The AMBA bus driver defines runtime Power Management functions which
disable and unprepare AMBA bus clock. This is problematic for runtime PM
because unpreparing a clock might sleep so it is not interrupt safe.
However some drivers may want to implement runtime PM functions in
interrupt-safe way (see pm_runtime_irq_safe()). If such driver
implements its own runtime PM functions then assume it will handle the
runtime PM completely and it will replace our clock handling.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@...sung.com>
---
drivers/amba/bus.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index 3cf61a127ee5..38461430b7cf 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -94,9 +94,18 @@ static int amba_pm_runtime_suspend(struct device *dev)
struct amba_device *pcdev = to_amba_device(dev);
int ret = pm_generic_runtime_suspend(dev);
- if (ret == 0 && dev->driver)
+ if (ret == 0 && dev->driver) {
+ /*
+ * If driver handles runtime suspend don't duplicate
+ * the work here.
+ */
+ if (dev->driver->pm && dev->driver->pm->runtime_suspend)
+ goto out;
+
clk_disable_unprepare(pcdev->pclk);
+ }
+out:
return ret;
}
@@ -106,12 +115,16 @@ static int amba_pm_runtime_resume(struct device *dev)
int ret;
if (dev->driver) {
+ if (dev->driver->pm && dev->driver->pm->runtime_resume)
+ goto out;
+
ret = clk_prepare_enable(pcdev->pclk);
/* Failure is probably fatal to the system, but... */
if (ret)
return ret;
}
+out:
return pm_generic_runtime_resume(dev);
}
#endif
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists