summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Huang <JinHuiEric.Huang@amd.com>2015-12-04 20:49:02 (GMT)
committerAlex Deucher <alexander.deucher@amd.com>2015-12-21 21:42:49 (GMT)
commitdb18ce397c0928bb420a511db52ce36c2003676e (patch)
treea848344899a93e0ab10812590b718804f3c40151
parent9dcfc1936aa0f6a18fd2852e224d59610cd73e7a (diff)
downloadlinux-db18ce397c0928bb420a511db52ce36c2003676e.tar.xz
drm/amd/powerplay: add functions set/get_fan_control_mode in hwmgr for Fiji.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c26
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/fiji_thermal.h1
2 files changed, 27 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c
index 8de045f..fec0789 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c
@@ -5045,6 +5045,30 @@ int fiji_register_internal_thermal_interrupt(struct pp_hwmgr *hwmgr,
return 0;
}
+static int fiji_set_fan_control_mode(struct pp_hwmgr *hwmgr, uint32_t mode)
+{
+ if (mode) {
+ /* stop auto-manage */
+ if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
+ PHM_PlatformCaps_MicrocodeFanControl))
+ fiji_fan_ctrl_stop_smc_fan_control(hwmgr);
+ fiji_fan_ctrl_set_static_mode(hwmgr, mode);
+ } else
+ /* restart auto-manage */
+ fiji_fan_ctrl_reset_fan_speed_to_default(hwmgr);
+
+ return 0;
+}
+
+static int fiji_get_fan_control_mode(struct pp_hwmgr *hwmgr)
+{
+ if (hwmgr->fan_ctrl_is_in_default_mode)
+ return hwmgr->fan_ctrl_default_mode;
+ else
+ return PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC,
+ CG_FDO_CTRL2, FDO_PWM_MODE);
+}
+
static const struct pp_hwmgr_func fiji_hwmgr_funcs = {
.backend_init = &fiji_hwmgr_backend_init,
.backend_fini = &tonga_hwmgr_backend_fini,
@@ -5078,6 +5102,8 @@ static const struct pp_hwmgr_func fiji_hwmgr_funcs = {
.set_fan_speed_rpm = fiji_fan_ctrl_set_fan_speed_rpm,
.uninitialize_thermal_controller = fiji_thermal_ctrl_uninitialize_thermal_controller,
.register_internal_thermal_interrupt = fiji_register_internal_thermal_interrupt,
+ .set_fan_control_mode = fiji_set_fan_control_mode,
+ .get_fan_control_mode = fiji_get_fan_control_mode,
};
int fiji_hwmgr_init(struct pp_hwmgr *hwmgr)
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_thermal.h b/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_thermal.h
index c3ee552..8621493 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_thermal.h
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_thermal.h
@@ -55,6 +55,7 @@ extern int pp_fiji_thermal_initialize(struct pp_hwmgr *hwmgr);
extern int fiji_thermal_ctrl_uninitialize_thermal_controller(struct pp_hwmgr *hwmgr);
extern int fiji_fan_ctrl_set_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t speed);
extern int fiji_fan_ctrl_get_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t *speed);
+extern int fiji_fan_ctrl_stop_smc_fan_control(struct pp_hwmgr *hwmgr);
extern uint32_t tonga_get_xclk(struct pp_hwmgr *hwmgr);
#endif