summaryrefslogtreecommitdiffstats
path: root/drivers/soc/rockchip/dtpm.c
blob: b36d4f752c302b58c6860e10e00a6d8ffbea0a95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright 2021 Linaro Limited
 *
 * Author: Daniel Lezcano <daniel.lezcano@linaro.org>
 *
 * DTPM hierarchy description
 */
#include <linux/dtpm.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>

static struct dtpm_node __initdata rk3399_hierarchy[] = {
	[0] = { .name = "rk3399",
		.type = DTPM_NODE_VIRTUAL },
	[1] = { .name = "package",
		.type = DTPM_NODE_VIRTUAL,
		.parent = &rk3399_hierarchy[0] },
	[2] = { .name = "/cpus/cpu@0",
		.type = DTPM_NODE_DT,
		.parent = &rk3399_hierarchy[1] },
	[3] = { .name = "/cpus/cpu@1",
		.type = DTPM_NODE_DT,
		.parent = &rk3399_hierarchy[1] },
	[4] = { .name = "/cpus/cpu@2",
		.type = DTPM_NODE_DT,
		.parent = &rk3399_hierarchy[1] },
	[5] = { .name = "/cpus/cpu@3",
		.type = DTPM_NODE_DT,
		.parent = &rk3399_hierarchy[1] },
	[6] = { .name = "/cpus/cpu@100",
		.type = DTPM_NODE_DT,
		.parent = &rk3399_hierarchy[1] },
	[7] = { .name = "/cpus/cpu@101",
		.type = DTPM_NODE_DT,
		.parent = &rk3399_hierarchy[1] },
	[8] = { .name = "/gpu@ff9a0000",
		.type = DTPM_NODE_DT,
		.parent = &rk3399_hierarchy[1] },
	[9] = { /* sentinel */ }
};

static struct of_device_id __initdata rockchip_dtpm_match_table[] = {
        { .compatible = "rockchip,rk3399", .data = rk3399_hierarchy },
        {},
};

static int __init rockchip_dtpm_init(void)
{
	return dtpm_create_hierarchy(rockchip_dtpm_match_table);
}
module_init(rockchip_dtpm_init);

static void __exit rockchip_dtpm_exit(void)
{
	return dtpm_destroy_hierarchy();
}
module_exit(rockchip_dtpm_exit);

MODULE_SOFTDEP("pre: panfrost cpufreq-dt");
MODULE_DESCRIPTION("Rockchip DTPM driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:dtpm");
MODULE_AUTHOR("Daniel Lezcano <daniel.lezcano@kernel.org");