GNU Linux-libre 4.19.264-gnu1
[releases.git] / arch / arm / mach-keystone / pm_domain.c
1 /*
2  * PM domain driver for Keystone2 devices
3  *
4  * Copyright 2013 Texas Instruments, Inc.
5  *      Santosh Shilimkar <santosh.shillimkar@ti.com>
6  *
7  * Based on Kevins work on DAVINCI SOCs
8  *      Kevin Hilman <khilman@linaro.org>
9  *
10  * This program is free software; you can redistribute it and/or modify it
11  * under the terms and conditions of the GNU General Public License,
12  * version 2, as published by the Free Software Foundation.
13  */
14
15 #include <linux/init.h>
16 #include <linux/pm_runtime.h>
17 #include <linux/pm_clock.h>
18 #include <linux/platform_device.h>
19 #include <linux/of.h>
20
21 #include "keystone.h"
22
23 static struct dev_pm_domain keystone_pm_domain = {
24         .ops = {
25                 USE_PM_CLK_RUNTIME_OPS
26                 USE_PLATFORM_PM_SLEEP_OPS
27         },
28 };
29
30 static struct pm_clk_notifier_block platform_domain_notifier = {
31         .pm_domain = &keystone_pm_domain,
32         .con_ids = { NULL },
33 };
34
35 static const struct of_device_id of_keystone_table[] = {
36         {.compatible = "ti,k2hk"},
37         {.compatible = "ti,k2e"},
38         {.compatible = "ti,k2l"},
39         { /* end of list */ },
40 };
41
42 int __init keystone_pm_runtime_init(void)
43 {
44         struct device_node *np;
45
46         np = of_find_matching_node(NULL, of_keystone_table);
47         if (!np)
48                 return 0;
49
50         pm_clk_add_notifier(&platform_bus_type, &platform_domain_notifier);
51
52         return 0;
53 }