diff options
-rw-r--r-- | arch/arm/mach-davinci/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-davinci/pm_domain.c | 64 |
2 files changed, 65 insertions, 0 deletions
diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile index 2db78bd5c835..2227effcb0e9 100644 --- a/arch/arm/mach-davinci/Makefile +++ b/arch/arm/mach-davinci/Makefile | |||
@@ -39,3 +39,4 @@ obj-$(CONFIG_MACH_OMAPL138_HAWKBOARD) += board-omapl138-hawk.o | |||
39 | obj-$(CONFIG_CPU_FREQ) += cpufreq.o | 39 | obj-$(CONFIG_CPU_FREQ) += cpufreq.o |
40 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o | 40 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o |
41 | obj-$(CONFIG_SUSPEND) += pm.o sleep.o | 41 | obj-$(CONFIG_SUSPEND) += pm.o sleep.o |
42 | obj-$(CONFIG_HAVE_CLK) += pm_domain.o | ||
diff --git a/arch/arm/mach-davinci/pm_domain.c b/arch/arm/mach-davinci/pm_domain.c new file mode 100644 index 000000000000..00946e23c1ee --- /dev/null +++ b/arch/arm/mach-davinci/pm_domain.c | |||
@@ -0,0 +1,64 @@ | |||
1 | /* | ||
2 | * Runtime PM support code for DaVinci | ||
3 | * | ||
4 | * Author: Kevin Hilman | ||
5 | * | ||
6 | * Copyright (C) 2012 Texas Instruments, Inc. | ||
7 | * | ||
8 | * This file is licensed under the terms of the GNU General Public | ||
9 | * License version 2. This program is licensed "as is" without any | ||
10 | * warranty of any kind, whether express or implied. | ||
11 | */ | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/pm_runtime.h> | ||
14 | #include <linux/pm_clock.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | |||
17 | #ifdef CONFIG_PM_RUNTIME | ||
18 | static int davinci_pm_runtime_suspend(struct device *dev) | ||
19 | { | ||
20 | int ret; | ||
21 | |||
22 | dev_dbg(dev, "%s\n", __func__); | ||
23 | |||
24 | ret = pm_generic_runtime_suspend(dev); | ||
25 | if (ret) | ||
26 | return ret; | ||
27 | |||
28 | ret = pm_clk_suspend(dev); | ||
29 | if (ret) { | ||
30 | pm_generic_runtime_resume(dev); | ||
31 | return ret; | ||
32 | } | ||
33 | |||
34 | return 0; | ||
35 | } | ||
36 | |||
37 | static int davinci_pm_runtime_resume(struct device *dev) | ||
38 | { | ||
39 | dev_dbg(dev, "%s\n", __func__); | ||
40 | |||
41 | pm_clk_resume(dev); | ||
42 | return pm_generic_runtime_resume(dev); | ||
43 | } | ||
44 | #endif | ||
45 | |||
46 | static struct dev_pm_domain davinci_pm_domain = { | ||
47 | .ops = { | ||
48 | SET_RUNTIME_PM_OPS(davinci_pm_runtime_suspend, | ||
49 | davinci_pm_runtime_resume, NULL) | ||
50 | USE_PLATFORM_PM_SLEEP_OPS | ||
51 | }, | ||
52 | }; | ||
53 | |||
54 | static struct pm_clk_notifier_block platform_bus_notifier = { | ||
55 | .pm_domain = &davinci_pm_domain, | ||
56 | }; | ||
57 | |||
58 | static int __init davinci_pm_runtime_init(void) | ||
59 | { | ||
60 | pm_clk_add_notifier(&platform_bus_type, &platform_bus_notifier); | ||
61 | |||
62 | return 0; | ||
63 | } | ||
64 | core_initcall(davinci_pm_runtime_init); | ||