diff options
author | Kevin Hilman <khilman@ti.com> | 2012-05-31 12:59:53 -0400 |
---|---|---|
committer | Sekhar Nori <nsekhar@ti.com> | 2012-07-01 07:56:26 -0400 |
commit | ce9dcb8784611c50974d1c6b600c71f5c0a29308 (patch) | |
tree | da210e30a548d98a531adca2d60795083de33d66 /arch/arm/mach-davinci | |
parent | 07caba966dee241cd6599618a243be721195de38 (diff) |
ARM: davinci: add runtime PM support for clock management
Add runtime PM core support to davinci by using the pm_clk
infrastructure of the PM core.
When runtime PM is enabled, the davinci runtime PM implementation will
use the pm_clk layer to enable/disable clocks on demand. When runtime
PM is disabled, the pm_clk core will automatically enable clocks when
the driver is bound and disable clocks when the driver is unbound.
Cc: Mark A. Greer <mgreer@animalcreek.com>
Cc: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
[nsekhar@ti.com: pruned list of header file includes and removed some
debug code]
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Diffstat (limited to 'arch/arm/mach-davinci')
-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); | ||