Merge tag 'gpio-v3.13-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[linux-2.6.git] / arch / arm / mach-davinci / pm_domain.c
blob6b98413cebd61179f100b2e77ac7237f97e6c102
1 /*
2 * Runtime PM support code for DaVinci
4 * Author: Kevin Hilman
6 * Copyright (C) 2012 Texas Instruments, Inc.
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.
12 #include <linux/init.h>
13 #include <linux/pm_runtime.h>
14 #include <linux/pm_clock.h>
15 #include <linux/platform_device.h>
17 #ifdef CONFIG_PM_RUNTIME
18 static int davinci_pm_runtime_suspend(struct device *dev)
20 int ret;
22 dev_dbg(dev, "%s\n", __func__);
24 ret = pm_generic_runtime_suspend(dev);
25 if (ret)
26 return ret;
28 ret = pm_clk_suspend(dev);
29 if (ret) {
30 pm_generic_runtime_resume(dev);
31 return ret;
34 return 0;
37 static int davinci_pm_runtime_resume(struct device *dev)
39 dev_dbg(dev, "%s\n", __func__);
41 pm_clk_resume(dev);
42 return pm_generic_runtime_resume(dev);
44 #endif
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
54 static struct pm_clk_notifier_block platform_bus_notifier = {
55 .pm_domain = &davinci_pm_domain,
56 .con_ids = { "fck", "master", "slave", NULL },
59 static int __init davinci_pm_runtime_init(void)
61 pm_clk_add_notifier(&platform_bus_type, &platform_bus_notifier);
63 return 0;
65 core_initcall(davinci_pm_runtime_init);