aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/powerplay/hwmgr/smu_helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/powerplay/hwmgr/smu_helper.c')
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/smu_helper.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu_helper.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu_helper.c
index 8ad4e6960efd..4714b5b59825 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu_helper.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu_helper.c
@@ -39,6 +39,50 @@ uint16_t convert_to_vddc(uint8_t vid)
39 return (uint16_t) ((6200 - (vid * 25)) / VOLTAGE_SCALE); 39 return (uint16_t) ((6200 - (vid * 25)) / VOLTAGE_SCALE);
40} 40}
41 41
42int phm_copy_clock_limits_array(
43 struct pp_hwmgr *hwmgr,
44 uint32_t **pptable_info_array,
45 const uint32_t *pptable_array,
46 uint32_t power_saving_clock_count)
47{
48 uint32_t array_size, i;
49 uint32_t *table;
50
51 array_size = sizeof(uint32_t) * power_saving_clock_count;
52 table = kzalloc(array_size, GFP_KERNEL);
53 if (NULL == table)
54 return -ENOMEM;
55
56 for (i = 0; i < power_saving_clock_count; i++)
57 table[i] = le32_to_cpu(pptable_array[i]);
58
59 *pptable_info_array = table;
60
61 return 0;
62}
63
64int phm_copy_overdrive_settings_limits_array(
65 struct pp_hwmgr *hwmgr,
66 uint32_t **pptable_info_array,
67 const uint32_t *pptable_array,
68 uint32_t od_setting_count)
69{
70 uint32_t array_size, i;
71 uint32_t *table;
72
73 array_size = sizeof(uint32_t) * od_setting_count;
74 table = kzalloc(array_size, GFP_KERNEL);
75 if (NULL == table)
76 return -ENOMEM;
77
78 for (i = 0; i < od_setting_count; i++)
79 table[i] = le32_to_cpu(pptable_array[i]);
80
81 *pptable_info_array = table;
82
83 return 0;
84}
85
42uint32_t phm_set_field_to_u32(u32 offset, u32 original_data, u32 field, u32 size) 86uint32_t phm_set_field_to_u32(u32 offset, u32 original_data, u32 field, u32 size)
43{ 87{
44 u32 mask = 0; 88 u32 mask = 0;