xref: /OK3568_Linux_fs/kernel/arch/arm/mach-davinci/pm_domain.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Runtime PM support code for DaVinci
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Author: Kevin Hilman
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * Copyright (C) 2012 Texas Instruments, Inc.
7*4882a593Smuzhiyun  *
8*4882a593Smuzhiyun  * This file is licensed under the terms of the GNU General Public
9*4882a593Smuzhiyun  * License version 2. This program is licensed "as is" without any
10*4882a593Smuzhiyun  * warranty of any kind, whether express or implied.
11*4882a593Smuzhiyun  */
12*4882a593Smuzhiyun #include <linux/init.h>
13*4882a593Smuzhiyun #include <linux/pm_runtime.h>
14*4882a593Smuzhiyun #include <linux/pm_clock.h>
15*4882a593Smuzhiyun #include <linux/platform_device.h>
16*4882a593Smuzhiyun #include <linux/of.h>
17*4882a593Smuzhiyun 
18*4882a593Smuzhiyun static struct dev_pm_domain davinci_pm_domain = {
19*4882a593Smuzhiyun 	.ops = {
20*4882a593Smuzhiyun 		USE_PM_CLK_RUNTIME_OPS
21*4882a593Smuzhiyun 		USE_PLATFORM_PM_SLEEP_OPS
22*4882a593Smuzhiyun 	},
23*4882a593Smuzhiyun };
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun static struct pm_clk_notifier_block platform_bus_notifier = {
26*4882a593Smuzhiyun 	.pm_domain = &davinci_pm_domain,
27*4882a593Smuzhiyun 	.con_ids = { "fck", "master", "slave", NULL },
28*4882a593Smuzhiyun };
29*4882a593Smuzhiyun 
davinci_pm_runtime_init(void)30*4882a593Smuzhiyun static int __init davinci_pm_runtime_init(void)
31*4882a593Smuzhiyun {
32*4882a593Smuzhiyun 	if (of_have_populated_dt())
33*4882a593Smuzhiyun 		return 0;
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun 	/* Use pm_clk as fallback if we're not using genpd. */
36*4882a593Smuzhiyun 	pm_clk_add_notifier(&platform_bus_type, &platform_bus_notifier);
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun 	return 0;
39*4882a593Smuzhiyun }
40*4882a593Smuzhiyun core_initcall(davinci_pm_runtime_init);
41