dtpm.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright 2021 Linaro Limited
  4. *
  5. * Author: Daniel Lezcano <[email protected]>
  6. *
  7. * DTPM hierarchy description
  8. */
  9. #include <linux/dtpm.h>
  10. #include <linux/module.h>
  11. #include <linux/of.h>
  12. #include <linux/platform_device.h>
  13. static struct dtpm_node __initdata rk3399_hierarchy[] = {
  14. [0]{ .name = "rk3399",
  15. .type = DTPM_NODE_VIRTUAL },
  16. [1]{ .name = "package",
  17. .type = DTPM_NODE_VIRTUAL,
  18. .parent = &rk3399_hierarchy[0] },
  19. [2]{ .name = "/cpus/cpu@0",
  20. .type = DTPM_NODE_DT,
  21. .parent = &rk3399_hierarchy[1] },
  22. [3]{ .name = "/cpus/cpu@1",
  23. .type = DTPM_NODE_DT,
  24. .parent = &rk3399_hierarchy[1] },
  25. [4]{ .name = "/cpus/cpu@2",
  26. .type = DTPM_NODE_DT,
  27. .parent = &rk3399_hierarchy[1] },
  28. [5]{ .name = "/cpus/cpu@3",
  29. .type = DTPM_NODE_DT,
  30. .parent = &rk3399_hierarchy[1] },
  31. [6]{ .name = "/cpus/cpu@100",
  32. .type = DTPM_NODE_DT,
  33. .parent = &rk3399_hierarchy[1] },
  34. [7]{ .name = "/cpus/cpu@101",
  35. .type = DTPM_NODE_DT,
  36. .parent = &rk3399_hierarchy[1] },
  37. [8]{ .name = "/gpu@ff9a0000",
  38. .type = DTPM_NODE_DT,
  39. .parent = &rk3399_hierarchy[1] },
  40. [9]{ /* sentinel */ }
  41. };
  42. static struct of_device_id __initdata rockchip_dtpm_match_table[] = {
  43. { .compatible = "rockchip,rk3399", .data = rk3399_hierarchy },
  44. {},
  45. };
  46. static int __init rockchip_dtpm_init(void)
  47. {
  48. return dtpm_create_hierarchy(rockchip_dtpm_match_table);
  49. }
  50. module_init(rockchip_dtpm_init);
  51. static void __exit rockchip_dtpm_exit(void)
  52. {
  53. return dtpm_destroy_hierarchy();
  54. }
  55. module_exit(rockchip_dtpm_exit);
  56. MODULE_SOFTDEP("pre: panfrost cpufreq-dt");
  57. MODULE_DESCRIPTION("Rockchip DTPM driver");
  58. MODULE_LICENSE("GPL");
  59. MODULE_ALIAS("platform:dtpm");
  60. MODULE_AUTHOR("Daniel Lezcano <[email protected]");