diff mbox

[1/3] amba: add no_pm_pclk_management flag to amba_driver

Message ID 1429191554-24972-2-git-send-email-r.baldyga@samsung.com (mailing list archive)
State Rejected
Headers show

Commit Message

Robert Baldyga April 16, 2015, 1:39 p.m. UTC
This patch introduces no_pm_pclk_management flag in struct amba_driver.
It causes that pclk is not touched in pm_runtime callbacks. This allows
to manage clock in device driver independently of power domain management.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
---
 drivers/amba/bus.c       | 6 ++++--
 include/linux/amba/bus.h | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

Comments

Russell King - ARM Linux April 16, 2015, 1:41 p.m. UTC | #1
On Thu, Apr 16, 2015 at 03:39:12PM +0200, Robert Baldyga wrote:
> This patch introduces no_pm_pclk_management flag in struct amba_driver.
> It causes that pclk is not touched in pm_runtime callbacks. This allows
> to manage clock in device driver independently of power domain management.

NAK.  We already have stuff in place to deal with the problem with
DMA engine using runtime PM, which causes pclk management to fall
back to the IRQ-safe clk_enable/clk_disable().
Robert Baldyga May 5, 2015, 6:21 a.m. UTC | #2
On 04/16/2015 03:41 PM, Russell King - ARM Linux wrote:
> On Thu, Apr 16, 2015 at 03:39:12PM +0200, Robert Baldyga wrote:
>> This patch introduces no_pm_pclk_management flag in struct amba_driver.
>> It causes that pclk is not touched in pm_runtime callbacks. This allows
>> to manage clock in device driver independently of power domain management.
> 
> NAK.  We already have stuff in place to deal with the problem with
> DMA engine using runtime PM, which causes pclk management to fall
> back to the IRQ-safe clk_enable/clk_disable().
> 

What kind of stuff do you mean? If we want to manage pclk independently
form runtime PM, we need to prevent AMBA driver from touching pclk.
Otherwise our clock management inside of dmaengine driver is ineffective
because pclk refcount is incremented by AMBA driver.

Thanks,
Robert Baldyga
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index f009936..75035f0 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -140,9 +140,10 @@  static struct device_attribute amba_dev_attrs[] = {
 static int amba_pm_runtime_suspend(struct device *dev)
 {
 	struct amba_device *pcdev = to_amba_device(dev);
+	struct amba_driver *pcdrv = to_amba_driver(dev->driver);
 	int ret = pm_generic_runtime_suspend(dev);
 
-	if (ret == 0 && dev->driver) {
+	if (ret == 0 && dev->driver && !pcdrv->no_pm_pclk_management) {
 		if (pm_runtime_is_irq_safe(dev))
 			clk_disable(pcdev->pclk);
 		else
@@ -155,9 +156,10 @@  static int amba_pm_runtime_suspend(struct device *dev)
 static int amba_pm_runtime_resume(struct device *dev)
 {
 	struct amba_device *pcdev = to_amba_device(dev);
+	struct amba_driver *pcdrv = to_amba_driver(dev->driver);
 	int ret;
 
-	if (dev->driver) {
+	if (dev->driver && !pcdrv->no_pm_pclk_management) {
 		if (pm_runtime_is_irq_safe(dev))
 			ret = clk_enable(pcdev->pclk);
 		else
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index 50fc668..a77378c 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -44,6 +44,7 @@  struct amba_driver {
 	int			(*suspend)(struct amba_device *, pm_message_t);
 	int			(*resume)(struct amba_device *);
 	const struct amba_id	*id_table;
+	unsigned int		no_pm_pclk_management:1;
 };
 
 /*