Commit 4545ae2e authored by Asher Song's avatar Asher Song Committed by Alex Deucher

drm/amdgpu: Revert "drm/amdgpu: getting fan speed pwm for vega10 properly"

This reverts commit 16fb4dca.

Unfortunately, that commit causes fan monitors can't be read and written
properly.

Fixes: 16fb4dca ("drm/amdgpu: getting fan speed pwm for vega10 properly")
Signed-off-by: default avatarAsher Song <Asher.Song@amd.com>
Reviewed-by: default avatarGuchun Chen <guchun.chen@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent a31e6287
...@@ -67,21 +67,22 @@ int vega10_fan_ctrl_get_fan_speed_info(struct pp_hwmgr *hwmgr, ...@@ -67,21 +67,22 @@ int vega10_fan_ctrl_get_fan_speed_info(struct pp_hwmgr *hwmgr,
int vega10_fan_ctrl_get_fan_speed_pwm(struct pp_hwmgr *hwmgr, int vega10_fan_ctrl_get_fan_speed_pwm(struct pp_hwmgr *hwmgr,
uint32_t *speed) uint32_t *speed)
{ {
struct amdgpu_device *adev = hwmgr->adev; uint32_t current_rpm;
uint32_t duty100, duty; uint32_t percent = 0;
uint64_t tmp64;
duty100 = REG_GET_FIELD(RREG32_SOC15(THM, 0, mmCG_FDO_CTRL1), if (hwmgr->thermal_controller.fanInfo.bNoFan)
CG_FDO_CTRL1, FMAX_DUTY100); return 0;
duty = REG_GET_FIELD(RREG32_SOC15(THM, 0, mmCG_THERMAL_STATUS),
CG_THERMAL_STATUS, FDO_PWM_DUTY);
if (!duty100) if (vega10_get_current_rpm(hwmgr, &current_rpm))
return -EINVAL; return -1;
if (hwmgr->thermal_controller.
advanceFanControlParameters.usMaxFanRPM != 0)
percent = current_rpm * 255 /
hwmgr->thermal_controller.
advanceFanControlParameters.usMaxFanRPM;
tmp64 = (uint64_t)duty * 255; *speed = MIN(percent, 255);
do_div(tmp64, duty100);
*speed = MIN((uint32_t)tmp64, 255);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment