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

From: Robert Baldyga
Date: Thu Apr 16 2015 - 09:39:59 EST


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@xxxxxxxxxxx>
---
drivers/amba/bus.c | 6 ++++--
include/linux/amba/bus.h | 1 +
2 files changed, 5 insertions(+), 2 deletions(-)

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;
};

/*
--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/