Merge tag 'amd-drm-fixes-5.11-2021-01-28' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes
amd-drm-fixes-5.11-2021-01-28: amdgpu: - Fix a fan control regression on some boards - Fix clang warning Signed-off-by: Dave Airlie <airlied@redhat.com> From: Alex Deucher <alexdeucher@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210128191558.3821-1-alexander.deucher@amd.com
This commit is contained in:
commit
e0ecafede8
@ -32,8 +32,8 @@ DCN30 = dcn30_init.o dcn30_hubbub.o dcn30_hubp.o dcn30_dpp.o dcn30_optc.o \
|
||||
|
||||
|
||||
ifdef CONFIG_X86
|
||||
CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -msse
|
||||
CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o := -mhard-float -msse
|
||||
CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -msse
|
||||
CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o := -msse
|
||||
endif
|
||||
|
||||
ifdef CONFIG_PPC64
|
||||
@ -45,6 +45,8 @@ ifdef CONFIG_CC_IS_GCC
|
||||
ifeq ($(call cc-ifversion, -lt, 0701, y), y)
|
||||
IS_OLD_GCC = 1
|
||||
endif
|
||||
CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o += -mhard-float
|
||||
CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o += -mhard-float
|
||||
endif
|
||||
|
||||
ifdef CONFIG_X86
|
||||
|
@ -14,7 +14,7 @@ DCN301 = dcn301_init.o dcn301_resource.o dcn301_dccg.o \
|
||||
dcn301_dio_link_encoder.o dcn301_hwseq.o dcn301_panel_cntl.o dcn301_hubbub.o
|
||||
|
||||
ifdef CONFIG_X86
|
||||
CFLAGS_$(AMDDALPATH)/dc/dcn301/dcn301_resource.o := -mhard-float -msse
|
||||
CFLAGS_$(AMDDALPATH)/dc/dcn301/dcn301_resource.o := -msse
|
||||
endif
|
||||
|
||||
ifdef CONFIG_PPC64
|
||||
@ -25,6 +25,7 @@ ifdef CONFIG_CC_IS_GCC
|
||||
ifeq ($(call cc-ifversion, -lt, 0701, y), y)
|
||||
IS_OLD_GCC = 1
|
||||
endif
|
||||
CFLAGS_$(AMDDALPATH)/dc/dcn301/dcn301_resource.o += -mhard-float
|
||||
endif
|
||||
|
||||
ifdef CONFIG_X86
|
||||
|
@ -13,7 +13,7 @@
|
||||
DCN3_02 = dcn302_init.o dcn302_hwseq.o dcn302_resource.o
|
||||
|
||||
ifdef CONFIG_X86
|
||||
CFLAGS_$(AMDDALPATH)/dc/dcn302/dcn302_resource.o := -mhard-float -msse
|
||||
CFLAGS_$(AMDDALPATH)/dc/dcn302/dcn302_resource.o := -msse
|
||||
endif
|
||||
|
||||
ifdef CONFIG_PPC64
|
||||
@ -24,6 +24,7 @@ ifdef CONFIG_CC_IS_GCC
|
||||
ifeq ($(call cc-ifversion, -lt, 0701, y), y)
|
||||
IS_OLD_GCC = 1
|
||||
endif
|
||||
CFLAGS_$(AMDDALPATH)/dc/dcn302/dcn302_resource.o += -mhard-float
|
||||
endif
|
||||
|
||||
ifdef CONFIG_X86
|
||||
|
@ -553,6 +553,7 @@ struct pptable_funcs {
|
||||
*clock_req);
|
||||
uint32_t (*get_fan_control_mode)(struct smu_context *smu);
|
||||
int (*set_fan_control_mode)(struct smu_context *smu, uint32_t mode);
|
||||
int (*set_fan_speed_percent)(struct smu_context *smu, uint32_t speed);
|
||||
int (*set_fan_speed_rpm)(struct smu_context *smu, uint32_t speed);
|
||||
int (*set_xgmi_pstate)(struct smu_context *smu, uint32_t pstate);
|
||||
int (*gfx_off_control)(struct smu_context *smu, bool enable);
|
||||
|
@ -203,6 +203,9 @@ int
|
||||
smu_v11_0_set_fan_control_mode(struct smu_context *smu,
|
||||
uint32_t mode);
|
||||
|
||||
int
|
||||
smu_v11_0_set_fan_speed_percent(struct smu_context *smu, uint32_t speed);
|
||||
|
||||
int smu_v11_0_set_fan_speed_rpm(struct smu_context *smu,
|
||||
uint32_t speed);
|
||||
|
||||
|
@ -2151,19 +2151,14 @@ int smu_get_fan_speed_percent(struct smu_context *smu, uint32_t *speed)
|
||||
int smu_set_fan_speed_percent(struct smu_context *smu, uint32_t speed)
|
||||
{
|
||||
int ret = 0;
|
||||
uint32_t rpm;
|
||||
|
||||
if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
mutex_lock(&smu->mutex);
|
||||
|
||||
if (smu->ppt_funcs->set_fan_speed_rpm) {
|
||||
if (speed > 100)
|
||||
speed = 100;
|
||||
rpm = speed * smu->fan_max_rpm / 100;
|
||||
ret = smu->ppt_funcs->set_fan_speed_rpm(smu, rpm);
|
||||
}
|
||||
if (smu->ppt_funcs->set_fan_speed_percent)
|
||||
ret = smu->ppt_funcs->set_fan_speed_percent(smu, speed);
|
||||
|
||||
mutex_unlock(&smu->mutex);
|
||||
|
||||
|
@ -2326,6 +2326,7 @@ static const struct pptable_funcs arcturus_ppt_funcs = {
|
||||
.display_clock_voltage_request = smu_v11_0_display_clock_voltage_request,
|
||||
.get_fan_control_mode = smu_v11_0_get_fan_control_mode,
|
||||
.set_fan_control_mode = smu_v11_0_set_fan_control_mode,
|
||||
.set_fan_speed_percent = smu_v11_0_set_fan_speed_percent,
|
||||
.set_fan_speed_rpm = smu_v11_0_set_fan_speed_rpm,
|
||||
.set_xgmi_pstate = smu_v11_0_set_xgmi_pstate,
|
||||
.gfx_off_control = smu_v11_0_gfx_off_control,
|
||||
|
@ -2456,6 +2456,7 @@ static const struct pptable_funcs navi10_ppt_funcs = {
|
||||
.display_clock_voltage_request = smu_v11_0_display_clock_voltage_request,
|
||||
.get_fan_control_mode = smu_v11_0_get_fan_control_mode,
|
||||
.set_fan_control_mode = smu_v11_0_set_fan_control_mode,
|
||||
.set_fan_speed_percent = smu_v11_0_set_fan_speed_percent,
|
||||
.set_fan_speed_rpm = smu_v11_0_set_fan_speed_rpm,
|
||||
.set_xgmi_pstate = smu_v11_0_set_xgmi_pstate,
|
||||
.gfx_off_control = smu_v11_0_gfx_off_control,
|
||||
|
@ -2802,6 +2802,7 @@ static const struct pptable_funcs sienna_cichlid_ppt_funcs = {
|
||||
.display_clock_voltage_request = smu_v11_0_display_clock_voltage_request,
|
||||
.get_fan_control_mode = smu_v11_0_get_fan_control_mode,
|
||||
.set_fan_control_mode = smu_v11_0_set_fan_control_mode,
|
||||
.set_fan_speed_percent = smu_v11_0_set_fan_speed_percent,
|
||||
.set_fan_speed_rpm = smu_v11_0_set_fan_speed_rpm,
|
||||
.set_xgmi_pstate = smu_v11_0_set_xgmi_pstate,
|
||||
.gfx_off_control = smu_v11_0_gfx_off_control,
|
||||
|
@ -1173,6 +1173,35 @@ smu_v11_0_set_fan_static_mode(struct smu_context *smu, uint32_t mode)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
smu_v11_0_set_fan_speed_percent(struct smu_context *smu, uint32_t speed)
|
||||
{
|
||||
struct amdgpu_device *adev = smu->adev;
|
||||
uint32_t duty100, duty;
|
||||
uint64_t tmp64;
|
||||
|
||||
if (speed > 100)
|
||||
speed = 100;
|
||||
|
||||
if (smu_v11_0_auto_fan_control(smu, 0))
|
||||
return -EINVAL;
|
||||
|
||||
duty100 = REG_GET_FIELD(RREG32_SOC15(THM, 0, mmCG_FDO_CTRL1),
|
||||
CG_FDO_CTRL1, FMAX_DUTY100);
|
||||
if (!duty100)
|
||||
return -EINVAL;
|
||||
|
||||
tmp64 = (uint64_t)speed * duty100;
|
||||
do_div(tmp64, 100);
|
||||
duty = (uint32_t)tmp64;
|
||||
|
||||
WREG32_SOC15(THM, 0, mmCG_FDO_CTRL0,
|
||||
REG_SET_FIELD(RREG32_SOC15(THM, 0, mmCG_FDO_CTRL0),
|
||||
CG_FDO_CTRL0, FDO_STATIC_DUTY, duty));
|
||||
|
||||
return smu_v11_0_set_fan_static_mode(smu, FDO_PWM_MODE_STATIC);
|
||||
}
|
||||
|
||||
int
|
||||
smu_v11_0_set_fan_control_mode(struct smu_context *smu,
|
||||
uint32_t mode)
|
||||
@ -1181,7 +1210,7 @@ smu_v11_0_set_fan_control_mode(struct smu_context *smu,
|
||||
|
||||
switch (mode) {
|
||||
case AMD_FAN_CTRL_NONE:
|
||||
ret = smu_v11_0_set_fan_speed_rpm(smu, smu->fan_max_rpm);
|
||||
ret = smu_v11_0_set_fan_speed_percent(smu, 100);
|
||||
break;
|
||||
case AMD_FAN_CTRL_MANUAL:
|
||||
ret = smu_v11_0_auto_fan_control(smu, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user