This source file includes following definitions.
- vega20_set_power_limit
- vega20_validate_power_level_request
- vega20_set_overdrive_target_percentage
- vega20_power_control_set_level
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #include "hwmgr.h"
25 #include "vega20_hwmgr.h"
26 #include "vega20_powertune.h"
27 #include "vega20_smumgr.h"
28 #include "vega20_ppsmc.h"
29 #include "vega20_inc.h"
30 #include "pp_debug.h"
31
32 int vega20_set_power_limit(struct pp_hwmgr *hwmgr, uint32_t n)
33 {
34 struct vega20_hwmgr *data =
35 (struct vega20_hwmgr *)(hwmgr->backend);
36
37 if (data->smu_features[GNLD_PPT].enabled)
38 return smum_send_msg_to_smc_with_parameter(hwmgr,
39 PPSMC_MSG_SetPptLimit, n);
40
41 return 0;
42 }
43
44 int vega20_validate_power_level_request(struct pp_hwmgr *hwmgr,
45 uint32_t tdp_percentage_adjustment, uint32_t tdp_absolute_value_adjustment)
46 {
47 return (tdp_percentage_adjustment > hwmgr->platform_descriptor.TDPLimit) ? -1 : 0;
48 }
49
50 static int vega20_set_overdrive_target_percentage(struct pp_hwmgr *hwmgr,
51 uint32_t adjust_percent)
52 {
53 return smum_send_msg_to_smc_with_parameter(hwmgr,
54 PPSMC_MSG_OverDriveSetPercentage, adjust_percent);
55 }
56
57 int vega20_power_control_set_level(struct pp_hwmgr *hwmgr)
58 {
59 int adjust_percent, result = 0;
60
61 if (PP_CAP(PHM_PlatformCaps_PowerContainment)) {
62 adjust_percent =
63 hwmgr->platform_descriptor.TDPAdjustmentPolarity ?
64 hwmgr->platform_descriptor.TDPAdjustment :
65 (-1 * hwmgr->platform_descriptor.TDPAdjustment);
66 result = vega20_set_overdrive_target_percentage(hwmgr,
67 (uint32_t)adjust_percent);
68 }
69 return result;
70 }