]>
Commit | Line | Data |
---|---|---|
e933ec7c KH |
1 | /* |
2 | * Runtime PM support code for OMAP1 | |
3 | * | |
4 | * Author: Kevin Hilman, Deep Root Systems, LLC | |
5 | * | |
6 | * Copyright (C) 2010 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/kernel.h> | |
14 | #include <linux/io.h> | |
15 | #include <linux/pm_runtime.h> | |
b5e8d269 | 16 | #include <linux/pm_clock.h> |
e933ec7c KH |
17 | #include <linux/platform_device.h> |
18 | #include <linux/mutex.h> | |
19 | #include <linux/clk.h> | |
20 | #include <linux/err.h> | |
21 | ||
22 | #include <plat/omap_device.h> | |
23 | #include <plat/omap-pm.h> | |
24 | ||
25 | #ifdef CONFIG_PM_RUNTIME | |
26 | static int omap1_pm_runtime_suspend(struct device *dev) | |
27 | { | |
600b776e | 28 | int ret; |
e933ec7c KH |
29 | |
30 | dev_dbg(dev, "%s\n", __func__); | |
31 | ||
32 | ret = pm_generic_runtime_suspend(dev); | |
600b776e RW |
33 | if (ret) |
34 | return ret; | |
e933ec7c | 35 | |
3d5c3036 | 36 | ret = pm_clk_suspend(dev); |
600b776e RW |
37 | if (ret) { |
38 | pm_generic_runtime_resume(dev); | |
39 | return ret; | |
e933ec7c KH |
40 | } |
41 | ||
42 | return 0; | |
600b776e | 43 | } |
e933ec7c KH |
44 | |
45 | static int omap1_pm_runtime_resume(struct device *dev) | |
46 | { | |
e933ec7c KH |
47 | dev_dbg(dev, "%s\n", __func__); |
48 | ||
3d5c3036 | 49 | pm_clk_resume(dev); |
600b776e RW |
50 | return pm_generic_runtime_resume(dev); |
51 | } | |
e933ec7c | 52 | |
564b905a | 53 | static struct dev_pm_domain default_pm_domain = { |
600b776e RW |
54 | .ops = { |
55 | .runtime_suspend = omap1_pm_runtime_suspend, | |
56 | .runtime_resume = omap1_pm_runtime_resume, | |
57 | USE_PLATFORM_PM_SLEEP_OPS | |
58 | }, | |
59 | }; | |
564b905a | 60 | #define OMAP1_PM_DOMAIN (&default_pm_domain) |
e9e35c5a | 61 | #else |
564b905a | 62 | #define OMAP1_PM_DOMAIN NULL |
e9e35c5a | 63 | #endif /* CONFIG_PM_RUNTIME */ |
e933ec7c | 64 | |
600b776e | 65 | static struct pm_clk_notifier_block platform_bus_notifier = { |
564b905a | 66 | .pm_domain = OMAP1_PM_DOMAIN, |
600b776e | 67 | .con_ids = { "ick", "fck", NULL, }, |
e933ec7c KH |
68 | }; |
69 | ||
70 | static int __init omap1_pm_runtime_init(void) | |
71 | { | |
7f9187c2 TL |
72 | if (!cpu_class_is_omap1()) |
73 | return -ENODEV; | |
74 | ||
3d5c3036 | 75 | pm_clk_add_notifier(&platform_bus_type, &platform_bus_notifier); |
e933ec7c KH |
76 | |
77 | return 0; | |
78 | } | |
79 | core_initcall(omap1_pm_runtime_init); | |
e9e35c5a | 80 |