diff options
author | Rex Zhu <Rex.Zhu@amd.com> | 2018-05-08 02:20:25 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-05-15 14:44:22 -0400 |
commit | 4ccd2d931c4bbebbca5a5e233f0d28ed57482e90 (patch) | |
tree | e819b80495c2bcb4be84ae9ff44a5e060b4618ba | |
parent | 267256b5d884b1494cf30636c66cd95eeb25f41f (diff) |
drm/amd/pp: Implement force_clock_level for RV
under manual dpm mode, user can set gfx/mem clock
through sysfs pp_dpm_sclk/mclk on Rv.
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c index be6d6e202819..8b75f525fe49 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c | |||
@@ -766,6 +766,51 @@ static int smu10_get_dal_power_level(struct pp_hwmgr *hwmgr, | |||
766 | static int smu10_force_clock_level(struct pp_hwmgr *hwmgr, | 766 | static int smu10_force_clock_level(struct pp_hwmgr *hwmgr, |
767 | enum pp_clock_type type, uint32_t mask) | 767 | enum pp_clock_type type, uint32_t mask) |
768 | { | 768 | { |
769 | struct smu10_hwmgr *data = hwmgr->backend; | ||
770 | struct smu10_voltage_dependency_table *mclk_table = | ||
771 | data->clock_vol_info.vdd_dep_on_fclk; | ||
772 | uint32_t low, high; | ||
773 | |||
774 | low = mask ? (ffs(mask) - 1) : 0; | ||
775 | high = mask ? (fls(mask) - 1) : 0; | ||
776 | |||
777 | switch (type) { | ||
778 | case PP_SCLK: | ||
779 | if (low > 2 || high > 2) { | ||
780 | pr_info("Currently sclk only support 3 levels on RV\n"); | ||
781 | return -EINVAL; | ||
782 | } | ||
783 | |||
784 | smum_send_msg_to_smc_with_parameter(hwmgr, | ||
785 | PPSMC_MSG_SetHardMinGfxClk, | ||
786 | low == 2 ? data->gfx_max_freq_limit/100 : | ||
787 | low == 1 ? SMU10_UMD_PSTATE_GFXCLK : | ||
788 | data->gfx_min_freq_limit/100); | ||
789 | |||
790 | smum_send_msg_to_smc_with_parameter(hwmgr, | ||
791 | PPSMC_MSG_SetSoftMaxGfxClk, | ||
792 | high == 0 ? data->gfx_min_freq_limit/100 : | ||
793 | high == 1 ? SMU10_UMD_PSTATE_GFXCLK : | ||
794 | data->gfx_max_freq_limit/100); | ||
795 | break; | ||
796 | |||
797 | case PP_MCLK: | ||
798 | if (low > mclk_table->count - 1 || high > mclk_table->count - 1) | ||
799 | return -EINVAL; | ||
800 | |||
801 | smum_send_msg_to_smc_with_parameter(hwmgr, | ||
802 | PPSMC_MSG_SetHardMinFclkByFreq, | ||
803 | mclk_table->entries[low].clk/100); | ||
804 | |||
805 | smum_send_msg_to_smc_with_parameter(hwmgr, | ||
806 | PPSMC_MSG_SetSoftMaxFclkByFreq, | ||
807 | mclk_table->entries[high].clk/100); | ||
808 | break; | ||
809 | |||
810 | case PP_PCIE: | ||
811 | default: | ||
812 | break; | ||
813 | } | ||
769 | return 0; | 814 | return 0; |
770 | } | 815 | } |
771 | 816 | ||