[PATCH 06/10] drm/amd/pp: Unified to ctrl autowattman/profile mode
Rex Zhu
Rex.Zhu at amd.com
Sat Feb 24 13:56:03 UTC 2018
Add a common hw interface to ctrl autowattman feature and
restore power profile mode.
when autowattman enabled, start the wattman queue when
power state is set. disable this feature when suspend/
enter manual mode.
when autowattman not support, just restore default power
profile mode in auto dpm level if it was changed.
FreeSync is enabled, disable or not set power profile mode.
Change-Id: Iee4c6a3deb4ba9bdd4fb56c5bca31c6365ccea3a
Signed-off-by: Rex Zhu <Rex.Zhu at amd.com>
---
.../gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c | 23 ++++++++++++++++++++++
drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c | 2 ++
.../gpu/drm/amd/powerplay/inc/hardwaremanager.h | 2 ++
3 files changed, 27 insertions(+)
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c
index f06f8f4..f97a455 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c
@@ -128,6 +128,29 @@ int phm_force_dpm_levels(struct pp_hwmgr *hwmgr, enum amd_dpm_forced_level level
return ret;
}
+int phm_power_profile_ctrl(struct pp_hwmgr *hwmgr, struct pp_power_state *new_ps)
+{
+ if (hwmgr->autowattman_mask) {
+ if (hwmgr->autowattman_enabled && hwmgr->hwmgr_func->start_auto_wattman != NULL) {
+ if ((new_ps != NULL && new_ps->classification.flags & PP_StateClassificationFlag_Boot)
+ || hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL)
+ hwmgr->hwmgr_func->start_auto_wattman(hwmgr, false);
+ else
+ hwmgr->hwmgr_func->start_auto_wattman(hwmgr, true);
+ } else {
+ if (hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_AUTO &&
+ hwmgr->default_power_profile_mode != hwmgr->power_profile_mode) {
+ long mode = hwmgr->default_power_profile_mode;
+
+ if (hwmgr->hwmgr_func->set_power_profile_mode != NULL)
+ hwmgr->hwmgr_func->set_power_profile_mode(hwmgr, &mode, 0);
+ }
+ }
+ }
+
+ return 0;
+}
+
int phm_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
struct pp_power_state *adjusted_ps,
const struct pp_power_state *current_ps)
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c
index ed3bd15..00c49080 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c
@@ -247,6 +247,8 @@ int psm_adjust_power_state_dynamic(struct pp_hwmgr *hwmgr, bool skip,
if (!phm_force_dpm_levels(hwmgr, hwmgr->request_dpm_level))
hwmgr->dpm_level = hwmgr->request_dpm_level;
+ phm_power_profile_ctrl(hwmgr, new_ps);
+
return 0;
}
diff --git a/drivers/gpu/drm/amd/powerplay/inc/hardwaremanager.h b/drivers/gpu/drm/amd/powerplay/inc/hardwaremanager.h
index b366a5b..fbe1cd2 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/hardwaremanager.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/hardwaremanager.h
@@ -448,5 +448,7 @@ extern int phm_display_clock_voltage_request(struct pp_hwmgr *hwmgr,
extern int phm_get_max_high_clocks(struct pp_hwmgr *hwmgr, struct amd_pp_simple_clock_info *clocks);
extern int phm_disable_smc_firmware_ctf(struct pp_hwmgr *hwmgr);
+extern int phm_power_profile_ctrl(struct pp_hwmgr *hwmgr, struct pp_power_state *new_ps);
+
#endif /* _HARDWARE_MANAGER_H_ */
--
1.9.1
More information about the amd-gfx
mailing list