From dd4bdf3b35dd8c33dfc41b9917f202f6602dfa48 Mon Sep 17 00:00:00 2001 From: Eric Huang Date: Wed, 1 Mar 2017 15:49:31 -0500 Subject: [PATCH] drm/amd/powerplay: add voltage change support through pp_table Disable avfs to make voltage change take effect. Signed-off-by: Eric Huang Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 12 +++++++++++- drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c index fde8fcd46b58..8132d464dcb6 100644 --- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c +++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c @@ -750,7 +750,17 @@ static int pp_dpm_set_pp_table(void *handle, const char *buf, size_t size) hwmgr->soft_pp_table = hwmgr->hardcode_pp_table; - return amd_powerplay_reset(handle); + ret = amd_powerplay_reset(handle); + if (ret) + return ret; + + if (hwmgr->hwmgr_func->avfs_control) { + ret = hwmgr->hwmgr_func->avfs_control(hwmgr, false); + if (ret) + return ret; + } + + return 0; } static int pp_dpm_force_clock_level(void *handle, diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h index 8cf5aed055b6..d5aa6cd115bf 100644 --- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h @@ -360,6 +360,7 @@ struct pp_hwmgr_func { int (*release_firmware)(struct pp_hwmgr *hwmgr); int (*set_power_profile_state)(struct pp_hwmgr *hwmgr, struct amd_pp_profile *request); + int (*avfs_control)(struct pp_hwmgr *hwmgr, bool enable); }; struct pp_table_func { -- 2.30.2