summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRabin Vincent <rabin.vincent@stericsson.com>2011-09-09 17:13:47 +0530
committerUlf Hansson <ulf.hansson@stericsson.com>2011-09-19 16:07:26 +0200
commitddf435ff6e5bc88fa2229ceac799aa0189978257 (patch)
tree3d33a96d08ceb47e794e8d88316edd0062e15d8e
parente7732bdd01b7f01e0bf2d61e7e8335aab9320944 (diff)
PM: Export AMBA bus type's default PM callbacks
Export the default PM callbacks defined for the platform bus type so that they can be used by power domains for suspending and resuming platform devices in the future. Like 69c9dd1ecf446ad8a830e4afc539a2a1adc85b78 ("PM: Export platform bus type's default PM callbacks"). Change-Id: I92aa13abe15c153aa5d90def7eb212626f6d0213 Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
-rw-r--r--drivers/amba/bus.c43
-rw-r--r--include/linux/amba/bus.h60
2 files changed, 75 insertions, 28 deletions
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index d74926e0939..6e4b1553afe 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -109,7 +109,7 @@ static int amba_legacy_resume(struct device *dev)
return ret;
}
-static int amba_pm_prepare(struct device *dev)
+int amba_pm_prepare(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
@@ -120,7 +120,7 @@ static int amba_pm_prepare(struct device *dev)
return ret;
}
-static void amba_pm_complete(struct device *dev)
+void amba_pm_complete(struct device *dev)
{
struct device_driver *drv = dev->driver;
@@ -137,7 +137,7 @@ static void amba_pm_complete(struct device *dev)
#ifdef CONFIG_SUSPEND
-static int amba_pm_suspend(struct device *dev)
+int amba_pm_suspend(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
@@ -155,7 +155,7 @@ static int amba_pm_suspend(struct device *dev)
return ret;
}
-static int amba_pm_suspend_noirq(struct device *dev)
+int amba_pm_suspend_noirq(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
@@ -171,7 +171,7 @@ static int amba_pm_suspend_noirq(struct device *dev)
return ret;
}
-static int amba_pm_resume(struct device *dev)
+int amba_pm_resume(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
@@ -189,7 +189,7 @@ static int amba_pm_resume(struct device *dev)
return ret;
}
-static int amba_pm_resume_noirq(struct device *dev)
+int amba_pm_resume_noirq(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
@@ -216,7 +216,7 @@ static int amba_pm_resume_noirq(struct device *dev)
#ifdef CONFIG_HIBERNATE_CALLBACKS
-static int amba_pm_freeze(struct device *dev)
+int amba_pm_freeze(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
@@ -234,7 +234,7 @@ static int amba_pm_freeze(struct device *dev)
return ret;
}
-static int amba_pm_freeze_noirq(struct device *dev)
+int amba_pm_freeze_noirq(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
@@ -250,7 +250,7 @@ static int amba_pm_freeze_noirq(struct device *dev)
return ret;
}
-static int amba_pm_thaw(struct device *dev)
+int amba_pm_thaw(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
@@ -268,7 +268,7 @@ static int amba_pm_thaw(struct device *dev)
return ret;
}
-static int amba_pm_thaw_noirq(struct device *dev)
+int amba_pm_thaw_noirq(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
@@ -284,7 +284,7 @@ static int amba_pm_thaw_noirq(struct device *dev)
return ret;
}
-static int amba_pm_poweroff(struct device *dev)
+int amba_pm_poweroff(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
@@ -302,7 +302,7 @@ static int amba_pm_poweroff(struct device *dev)
return ret;
}
-static int amba_pm_poweroff_noirq(struct device *dev)
+int amba_pm_poweroff_noirq(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
@@ -318,7 +318,7 @@ static int amba_pm_poweroff_noirq(struct device *dev)
return ret;
}
-static int amba_pm_restore(struct device *dev)
+int amba_pm_restore(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
@@ -336,7 +336,7 @@ static int amba_pm_restore(struct device *dev)
return ret;
}
-static int amba_pm_restore_noirq(struct device *dev)
+int amba_pm_restore_noirq(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
@@ -368,20 +368,7 @@ static int amba_pm_restore_noirq(struct device *dev)
#ifdef CONFIG_PM
static const struct dev_pm_ops amba_pm = {
- .prepare = amba_pm_prepare,
- .complete = amba_pm_complete,
- .suspend = amba_pm_suspend,
- .resume = amba_pm_resume,
- .freeze = amba_pm_freeze,
- .thaw = amba_pm_thaw,
- .poweroff = amba_pm_poweroff,
- .restore = amba_pm_restore,
- .suspend_noirq = amba_pm_suspend_noirq,
- .resume_noirq = amba_pm_resume_noirq,
- .freeze_noirq = amba_pm_freeze_noirq,
- .thaw_noirq = amba_pm_thaw_noirq,
- .poweroff_noirq = amba_pm_poweroff_noirq,
- .restore_noirq = amba_pm_restore_noirq,
+ USE_AMBA_PM_SLEEP_OPS
SET_RUNTIME_PM_OPS(
pm_generic_runtime_suspend,
pm_generic_runtime_resume,
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index fcbbe71a3cc..849aec9aba5 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -94,4 +94,64 @@ void amba_release_regions(struct amba_device *);
#define amba_manf(d) AMBA_MANF_BITS((d)->periphid)
#define amba_part(d) AMBA_PART_BITS((d)->periphid)
+#ifdef CONFIG_PM_SLEEP
+extern int amba_pm_prepare(struct device *dev);
+extern void amba_pm_complete(struct device *dev);
+#else
+#define amba_pm_prepare NULL
+#define amba_pm_complete NULL
+#endif
+
+#ifdef CONFIG_SUSPEND
+extern int amba_pm_suspend(struct device *dev);
+extern int amba_pm_suspend_noirq(struct device *dev);
+extern int amba_pm_resume(struct device *dev);
+extern int amba_pm_resume_noirq(struct device *dev);
+#else
+#define amba_pm_suspend NULL
+#define amba_pm_resume NULL
+#define amba_pm_suspend_noirq NULL
+#define amba_pm_resume_noirq NULL
+#endif
+
+#ifdef CONFIG_HIBERNATE_CALLBACKS
+extern int amba_pm_freeze(struct device *dev);
+extern int amba_pm_freeze_noirq(struct device *dev);
+extern int amba_pm_thaw(struct device *dev);
+extern int amba_pm_thaw_noirq(struct device *dev);
+extern int amba_pm_poweroff(struct device *dev);
+extern int amba_pm_poweroff_noirq(struct device *dev);
+extern int amba_pm_restore(struct device *dev);
+extern int amba_pm_restore_noirq(struct device *dev);
+#else
+#define amba_pm_freeze NULL
+#define amba_pm_thaw NULL
+#define amba_pm_poweroff NULL
+#define amba_pm_restore NULL
+#define amba_pm_freeze_noirq NULL
+#define amba_pm_thaw_noirq NULL
+#define amba_pm_poweroff_noirq NULL
+#define amba_pm_restore_noirq NULL
+#endif
+
+#ifdef CONFIG_PM_SLEEP
+#define USE_AMBA_PM_SLEEP_OPS \
+ .prepare = amba_pm_prepare, \
+ .complete = amba_pm_complete, \
+ .suspend = amba_pm_suspend, \
+ .resume = amba_pm_resume, \
+ .freeze = amba_pm_freeze, \
+ .thaw = amba_pm_thaw, \
+ .poweroff = amba_pm_poweroff, \
+ .restore = amba_pm_restore, \
+ .suspend_noirq = amba_pm_suspend_noirq, \
+ .resume_noirq = amba_pm_resume_noirq, \
+ .freeze_noirq = amba_pm_freeze_noirq, \
+ .thaw_noirq = amba_pm_thaw_noirq, \
+ .poweroff_noirq = amba_pm_poweroff_noirq, \
+ .restore_noirq = amba_pm_restore_noirq,
+#else
+#define USE_AMBA_PM_SLEEP_OPS
+#endif
+
#endif