Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * Copyright 2021 Linaro Limited
0004  *
0005  * Author: Daniel Lezcano <daniel.lezcano@linaro.org>
0006  *
0007  * DTPM hierarchy description
0008  */
0009 #include <linux/dtpm.h>
0010 #include <linux/module.h>
0011 #include <linux/of.h>
0012 #include <linux/platform_device.h>
0013 
0014 static struct dtpm_node __initdata rk3399_hierarchy[] = {
0015     [0]{ .name = "rk3399",
0016          .type = DTPM_NODE_VIRTUAL },
0017     [1]{ .name = "package",
0018          .type = DTPM_NODE_VIRTUAL,
0019          .parent = &rk3399_hierarchy[0] },
0020     [2]{ .name = "/cpus/cpu@0",
0021          .type = DTPM_NODE_DT,
0022          .parent = &rk3399_hierarchy[1] },
0023     [3]{ .name = "/cpus/cpu@1",
0024          .type = DTPM_NODE_DT,
0025          .parent = &rk3399_hierarchy[1] },
0026     [4]{ .name = "/cpus/cpu@2",
0027          .type = DTPM_NODE_DT,
0028          .parent = &rk3399_hierarchy[1] },
0029     [5]{ .name = "/cpus/cpu@3",
0030          .type = DTPM_NODE_DT,
0031          .parent = &rk3399_hierarchy[1] },
0032     [6]{ .name = "/cpus/cpu@100",
0033          .type = DTPM_NODE_DT,
0034          .parent = &rk3399_hierarchy[1] },
0035     [7]{ .name = "/cpus/cpu@101",
0036          .type = DTPM_NODE_DT,
0037          .parent = &rk3399_hierarchy[1] },
0038     [8]{ .name = "/gpu@ff9a0000",
0039          .type = DTPM_NODE_DT,
0040          .parent = &rk3399_hierarchy[1] },
0041     [9]{ /* sentinel */ }
0042 };
0043 
0044 static struct of_device_id __initdata rockchip_dtpm_match_table[] = {
0045         { .compatible = "rockchip,rk3399", .data = rk3399_hierarchy },
0046         {},
0047 };
0048 
0049 static int __init rockchip_dtpm_init(void)
0050 {
0051     return dtpm_create_hierarchy(rockchip_dtpm_match_table);
0052 }
0053 module_init(rockchip_dtpm_init);
0054 
0055 static void __exit rockchip_dtpm_exit(void)
0056 {
0057     return dtpm_destroy_hierarchy();
0058 }
0059 module_exit(rockchip_dtpm_exit);
0060 
0061 MODULE_SOFTDEP("pre: panfrost cpufreq-dt");
0062 MODULE_DESCRIPTION("Rockchip DTPM driver");
0063 MODULE_LICENSE("GPL");
0064 MODULE_ALIAS("platform:dtpm");
0065 MODULE_AUTHOR("Daniel Lezcano <daniel.lezcano@kernel.org");