GNU Linux-libre 6.1.90-gnu
[releases.git] / arch / arm / mach-davinci / pm_domain.c
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Runtime PM support code for DaVinci
4  *
5  * Author: Kevin Hilman
6  *
7  * Copyright (C) 2012 Texas Instruments, Inc.
8  */
9 #include <linux/init.h>
10 #include <linux/pm_runtime.h>
11 #include <linux/pm_clock.h>
12 #include <linux/platform_device.h>
13 #include <linux/of.h>
14
15 static struct dev_pm_domain davinci_pm_domain = {
16         .ops = {
17                 USE_PM_CLK_RUNTIME_OPS
18                 USE_PLATFORM_PM_SLEEP_OPS
19         },
20 };
21
22 static struct pm_clk_notifier_block platform_bus_notifier = {
23         .pm_domain = &davinci_pm_domain,
24         .con_ids = { "fck", "master", "slave", NULL },
25 };
26
27 static int __init davinci_pm_runtime_init(void)
28 {
29         if (of_have_populated_dt())
30                 return 0;
31
32         /* Use pm_clk as fallback if we're not using genpd. */
33         pm_clk_add_notifier(&platform_bus_type, &platform_bus_notifier);
34
35         return 0;
36 }
37 core_initcall(davinci_pm_runtime_init);