Linux-libre 5.4.49-gnu
[librecmc/linux-libre.git] / arch / arm / mach-keystone / pm_domain.c
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * PM domain driver for Keystone2 devices
4  *
5  * Copyright 2013 Texas Instruments, Inc.
6  *      Santosh Shilimkar <santosh.shillimkar@ti.com>
7  *
8  * Based on Kevins work on DAVINCI SOCs
9  *      Kevin Hilman <khilman@linaro.org>
10  */
11
12 #include <linux/init.h>
13 #include <linux/pm_runtime.h>
14 #include <linux/pm_clock.h>
15 #include <linux/platform_device.h>
16 #include <linux/of.h>
17
18 #include "keystone.h"
19
20 static struct dev_pm_domain keystone_pm_domain = {
21         .ops = {
22                 USE_PM_CLK_RUNTIME_OPS
23                 USE_PLATFORM_PM_SLEEP_OPS
24         },
25 };
26
27 static struct pm_clk_notifier_block platform_domain_notifier = {
28         .pm_domain = &keystone_pm_domain,
29         .con_ids = { NULL },
30 };
31
32 static const struct of_device_id of_keystone_table[] = {
33         {.compatible = "ti,k2hk"},
34         {.compatible = "ti,k2e"},
35         {.compatible = "ti,k2l"},
36         { /* end of list */ },
37 };
38
39 int __init keystone_pm_runtime_init(void)
40 {
41         struct device_node *np;
42
43         np = of_find_matching_node(NULL, of_keystone_table);
44         if (!np)
45                 return 0;
46
47         pm_clk_add_notifier(&platform_bus_type, &platform_domain_notifier);
48
49         return 0;
50 }