1 /*
2 * Arm SCP/MCP Software
3 * Copyright (c) 2023, Arm Limited and Contributors. All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8 #include <tc2_dvfs.h>
9
10 #include <mod_tc2_power_model.h>
11 #include <mod_thermal_mgmt.h>
12
13 #include <fwk_element.h>
14 #include <fwk_id.h>
15 #include <fwk_module.h>
16
17 #include <stddef.h>
18 #include <stdint.h>
19
20 static struct mod_thermal_mgmt_actor_config actor_table_domain0[2] = {
21 [0] = {
22 .driver_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_TC2_POWER_MODEL, 0),
23 .dvfs_domain_id =
24 FWK_ID_ELEMENT_INIT(
25 FWK_MODULE_IDX_DVFS, DVFS_ELEMENT_IDX_HAYES),
26 .weight = 100,
27 },
28 [1] = {
29 .driver_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_TC2_POWER_MODEL, 1),
30 .dvfs_domain_id =
31 FWK_ID_ELEMENT_INIT(
32 FWK_MODULE_IDX_DVFS, DVFS_ELEMENT_IDX_HUNTER),
33 .weight = 100,
34 },
35 };
36
37 static const struct fwk_element thermal_mgmt_domains_elem_table[2] = {
38 [0] = {
39 .name = "Thermal Domain 0",
40 .data = &((struct mod_thermal_mgmt_dev_config){
41 .slow_loop_mult = 25,
42 .tdp = 10,
43 .pi_controller = {
44 .switch_on_temperature = 50,
45 .control_temperature = 60,
46 .integral_cutoff = 0,
47 .integral_max = 100,
48 .k_p_undershoot = 1,
49 .k_p_overshoot = 1,
50 .k_integral = 1,
51 },
52 .sensor_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_SENSOR, 0),
53 .driver_api_id = FWK_ID_API_INIT(
54 FWK_MODULE_IDX_TC2_POWER_MODEL,
55 MOD_TC2_POWER_MODEL_THERMAL_DRIVER_API_IDX),
56 .thermal_actors_table = actor_table_domain0,
57 .thermal_actors_count = FWK_ARRAY_SIZE(actor_table_domain0),
58 }),
59 },
60 [1] = { 0 } /* Termination description */
61 };
62
get_element_table(fwk_id_t module_id)63 static const struct fwk_element *get_element_table(fwk_id_t module_id)
64 {
65 return thermal_mgmt_domains_elem_table;
66 }
67
68 struct fwk_module_config config_thermal_mgmt = {
69 .elements = FWK_MODULE_DYNAMIC_ELEMENTS(get_element_table),
70 };
71