drm/amd/pp: Implement get_power_profile_mode on smu7
Subsystems (2)
PATCH 1/1 drm/amd/pp: Implement get_power_profile_mode on smu7
Use can get smu7 profile pamameters through sysfs
cat pp_power_profile_mode
NUM MODE_NAME UP_HYST DOWN_HYST ACTIVE_LEVEL
0 3D_FULL_SCREEN*: 0 100 30 1 POWER_SAVING : 10 0 30 2 COMPUTER : 0 5 30
3 CUSTOM : 0 0 0
--- drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 43 ++++++++++++++++++++++++ drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h | 1 + 2 files changed, 44 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +43 -0
@@ -4927,6 +4927,47 @@ static int smu7_odn_edit_dpm_table(struct pp_hwmgr *hwmgr,return 0 ; } +static int smu7_get_power_profile_mode (struct pp_hwmgr *hwmgr,char *buf) +{ +struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); +uint32_t i, size =0 ; +static const uint8_t profile_mode_setting[3 ][3 ] = {{0 ,100 ,30 }, + {10 ,0 ,30 }, + {0 ,5 ,30 }, + }; +static const char *profile_name[4 ] = {"3D_FULL_SCREEN" , +"POWER_SAVING" , +"COMPUTER" , +"CUSTOM" }; +static const char *title[5 ] = {"NUM" , +"MODE_NAME" , +"UP_HYST" , +"DOWN_HYST" , +"ACTIVE_LEVEL" }; + +if (!buf) +return -EINVAL ; + + size +=sprintf (buf + size,"%s %16s %s %s %s\n" ,title[0 ], + title[1 ], title[2 ], title[3 ], title[4 ]); + +for (i =0 ; i <3 ; i++) + size +=sprintf (buf + size,"%3d %14s%s: %3d %9d %12d\n" , + i, profile_name[i], (i == hwmgr->power_profile_mode) ?"*" :" " , + profile_mode_setting[i][0 ], profile_mode_setting[i][1 ], + profile_mode_setting[i][2 ]); + size +=sprintf (buf + size,"%3d %14s%s: %3d %9d %12d\n" , i, + profile_name[i], (i == hwmgr->power_profile_mode) ?"*" :" " , + data->custom_profile_mode[0 ], data->custom_profile_mode[1 ], + data->custom_profile_mode[2 ]); +return size; +} + +static int smu7_set_power_profile_mode (struct pp_hwmgr *hwmgr,long *input,uint32_t size) +{ +/* To Do */ +return 0 ; +}static const struct pp_hwmgr_func smu7_hwmgr_funcs = { .backend_init = &smu7_hwmgr_backend_init,
@@ -4983,6 +5024,8 @@ static int smu7_odn_edit_dpm_table(struct pp_hwmgr *hwmgr, .get_max_high_clocks = smu7_get_max_high_clocks, .get_thermal_temperature_range = smu7_get_thermal_temperature_range, .odn_edit_dpm_table = smu7_odn_edit_dpm_table, + .get_power_profile_mode = smu7_get_power_profile_mode, + .set_power_profile_mode = smu7_set_power_profile_mode, }; uint8_t smu7_get_sleep_divider_id_from_clock(uint32_t clock,
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h +1 -0
@@ -315,6 +315,7 @@ struct smu7_hwmgr {uint16_t mem_latency_high;uint16_t mem_latency_low;uint32_t vr_config; +uint8_t custom_profile_mode[3 ]; };/* To convert to Q8.8 format for firmware */
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1516356957-23699-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org
Quoted 25 lines · Rex Zhu
Use can get smu7 profile pamameters through sysfs
cat
pp_power_profile_modeNUM
MODE_NAMEUP_HYSTDOWN_HYSTACTIVE_LEVEL0 3D_FULL_SCREEN*: 0 100 30 1 POWER_SAVING : 10 0 30 2 COMPUTER : 0 5 303 CUSTOM : 0 0 0
Change-Id I8fe8bf88c2d7400a097fba2c0a3748350e35f619Signed-off-by Rex Zhu <[email protected]>--- drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 43 ++++++++++++++++++++++++ drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h | 1 + 2 files changed, 44 insertions(+)drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0
-0@@ -4927,6 +4927,47 @@ static int smu7_odn_edit_dpm_table(struct pp_hwmgr *hwmgr,return 0 ; }
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_odn_edit_dpm_table(struct pp_hwmgr *hwmgr, · line 4939
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +10
-0+static int smu7_get_power_profile_mode (struct pp_hwmgr *hwmgr,char *buf) +{ +struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); +uint32_t i, size =0 ; +static const uint8_t profile_mode_setting[3 ][3 ] = {{0 ,100 ,30 }, + {10 ,0 ,30 }, + {0 ,5 ,30 }, + }; +static const char *profile_name[4 ] = {"3D_FULL_SCREEN" , +"POWER_SAVING" ,
Please add VIDEO and VR profiles as well.
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_odn_edit_dpm_table(struct pp_hwmgr *hwmgr, · line 4940
Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +1
-0+ "COMPUTER",
This should be COMPUTE. I sent a patch to fix vega10 as well.
Quoted 57 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +32
-0+ "CUSTOM"}; +static const char *title[5 ] = {"NUM" , +"MODE_NAME" , +"UP_HYST" , +"DOWN_HYST" , +"ACTIVE_LEVEL" }; + +if (!buf) +return -EINVAL ; + + size +=sprintf (buf + size,"%s %16s %s %s %s\n" ,title[0 ], + title[1 ], title[2 ], title[3 ], title[4 ]); + +for (i =0 ; i <3 ; i++) + size +=sprintf (buf + size,"%3d %14s%s: %3d %9d %12d\n" , + i, profile_name[i], (i == hwmgr->power_profile_mode) ?"*" :" " , + profile_mode_setting[i][0 ], profile_mode_setting[i][1 ], + profile_mode_setting[i][2 ]); + size +=sprintf (buf + size,"%3d %14s%s: %3d %9d %12d\n" , i, + profile_name[i], (i == hwmgr->power_profile_mode) ?"*" :" " , + data->custom_profile_mode[0 ], data->custom_profile_mode[1 ], + data->custom_profile_mode[2 ]); +return size; +} + +static int smu7_set_power_profile_mode (struct pp_hwmgr *hwmgr,long *input,uint32_t size) +{ +/* To Do */ +return 0 ; +}static const struct pp_hwmgr_func smu7_hwmgr_funcs = { .backend_init = &smu7_hwmgr_backend_init,@@ -4983,6 +5024,8 @@ static int smu7_odn_edit_dpm_table(struct pp_hwmgr *hwmgr, .get_max_high_clocks = smu7_get_max_high_clocks, .get_thermal_temperature_range = smu7_get_thermal_temperature_range, .odn_edit_dpm_table = smu7_odn_edit_dpm_table, + .get_power_profile_mode = smu7_get_power_profile_mode, + .set_power_profile_mode = smu7_set_power_profile_mode, }; uint8_t smu7_get_sleep_divider_id_from_clock(uint32_t clock,drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h +1
-1@@ -315,6 +315,7 @@ struct smu7_hwmgr {uint16_t mem_latency_high;uint16_t mem_latency_low;uint32_t vr_config; +uint8_t custom_profile_mode[3 ]; };/* To convert to Q8.8 format for firmware */ --1.9.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx