Commit | Line | Data |
---|---|---|
f14c4f14 | 1 | /* |
d03299ee | 2 | * Runtime PM support code |
f14c4f14 MD |
3 | * |
4 | * Copyright (C) 2009-2010 Magnus Damm | |
5 | * | |
6 | * This file is subject to the terms and conditions of the GNU General Public | |
7 | * License. See the file "COPYING" in the main directory of this archive | |
8 | * for more details. | |
9 | */ | |
10 | ||
11 | #include <linux/init.h> | |
12 | #include <linux/kernel.h> | |
13 | #include <linux/io.h> | |
14 | #include <linux/pm_runtime.h> | |
79620414 | 15 | #include <linux/pm_domain.h> |
b5e8d269 | 16 | #include <linux/pm_clock.h> |
f14c4f14 MD |
17 | #include <linux/platform_device.h> |
18 | #include <linux/clk.h> | |
19 | #include <linux/sh_clk.h> | |
20 | #include <linux/bitmap.h> | |
1d2b71f6 | 21 | #include <linux/slab.h> |
f14c4f14 | 22 | |
564b905a | 23 | static struct dev_pm_domain default_pm_domain = { |
38ade3a1 | 24 | .ops = { |
d2c4b43d | 25 | USE_PM_CLK_RUNTIME_OPS |
38ade3a1 RW |
26 | USE_PLATFORM_PM_SLEEP_OPS |
27 | }, | |
28 | }; | |
29 | ||
85eb8c8d | 30 | static struct pm_clk_notifier_block platform_bus_notifier = { |
d2c4b43d | 31 | .pm_domain = &default_pm_domain, |
85eb8c8d | 32 | .con_ids = { NULL, }, |
f14c4f14 MD |
33 | }; |
34 | ||
35 | static int __init sh_pm_runtime_init(void) | |
36 | { | |
0378ba48 | 37 | if (IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_ARCH_SHMOBILE)) { |
cbc41d0a GU |
38 | if (!of_find_compatible_node(NULL, NULL, |
39 | "renesas,cpg-mstp-clocks")) | |
40 | return 0; | |
41 | if (IS_ENABLED(CONFIG_PM_GENERIC_DOMAINS_OF) && | |
42 | of_find_node_with_property(NULL, "#power-domain-cells")) | |
3c90c55d GU |
43 | return 0; |
44 | } | |
45 | ||
3d5c3036 | 46 | pm_clk_add_notifier(&platform_bus_type, &platform_bus_notifier); |
f14c4f14 MD |
47 | return 0; |
48 | } | |
49 | core_initcall(sh_pm_runtime_init); |