This is a note to let you know that I've just added the patch titled Revert "drm/amdgpu: Revert "drm/amdgpu: getting fan speed pwm for vega10 properly"" to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: revert-drm-amdgpu-revert-drm-amdgpu-getting-fan-speed-pwm-for-vega10-properly.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From alexander.deucher@xxxxxxx Sat Jan 14 14:58:11 2023 From: Alex Deucher <alexander.deucher@xxxxxxx> Date: Fri, 13 Jan 2023 14:03:02 -0500 Subject: Revert "drm/amdgpu: Revert "drm/amdgpu: getting fan speed pwm for vega10 properly"" To: <gregkh@xxxxxxxxxxxxxxxxxxx>, <stable@xxxxxxxxxxxxxxx> Cc: Alex Deucher <alexander.deucher@xxxxxxx>, Sasha Levin <sashal@xxxxxxxxxx>, Yury Zhuravlev <stalkerg@xxxxxxxxx>, Guchun Chen <guchun.chen@xxxxxxx>, "Asher Song" <Asher.Song@xxxxxxx> Message-ID: <20230113190302.2210187-1-alexander.deucher@xxxxxxx> From: Alex Deucher <alexander.deucher@xxxxxxx> This reverts commit 9ccd11718d76b95c69aa773f2abedef560776037 The original commit 16fb4dca95daa ("drm/amdgpu: getting fan speed pwm for vega10 properly") was reverted in commit 4545ae2ed3f2 ("drm/amdgpu: Revert "drm/amdgpu: getting fan speed pwm for vega10 properly""). but the test that resulted in the revert was wrong and was fixed so the revert was reverted in commit 30b8e7b8ee3b ("Revert "drm/amdgpu: Revert "drm/amdgpu: getting fan speed pwm for vega10 properly"""). That should have been the end of it, but then Sasha picked up the original revert again and it was committed as 9ccd11718d76. So drop that commit so we get back to where we need to be. Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx> Cc: Sasha Levin <sashal@xxxxxxxxxx> Cc: stable@xxxxxxxxxxxxxxx # 6.1.x Cc: Yury Zhuravlev <stalkerg@xxxxxxxxx> Cc: Guchun Chen <guchun.chen@xxxxxxx> Cc: Asher Song <Asher.Song@xxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_thermal.c | 25 +++++++--------- 1 file changed, 12 insertions(+), 13 deletions(-) --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_thermal.c +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_thermal.c @@ -67,22 +67,21 @@ int vega10_fan_ctrl_get_fan_speed_info(s int vega10_fan_ctrl_get_fan_speed_pwm(struct pp_hwmgr *hwmgr, uint32_t *speed) { - uint32_t current_rpm; - uint32_t percent = 0; + struct amdgpu_device *adev = hwmgr->adev; + uint32_t duty100, duty; + uint64_t tmp64; - if (hwmgr->thermal_controller.fanInfo.bNoFan) - return 0; + duty100 = REG_GET_FIELD(RREG32_SOC15(THM, 0, mmCG_FDO_CTRL1), + CG_FDO_CTRL1, FMAX_DUTY100); + duty = REG_GET_FIELD(RREG32_SOC15(THM, 0, mmCG_THERMAL_STATUS), + CG_THERMAL_STATUS, FDO_PWM_DUTY); - if (vega10_get_current_rpm(hwmgr, ¤t_rpm)) - return -1; + if (!duty100) + return -EINVAL; - if (hwmgr->thermal_controller. - advanceFanControlParameters.usMaxFanRPM != 0) - percent = current_rpm * 255 / - hwmgr->thermal_controller. - advanceFanControlParameters.usMaxFanRPM; - - *speed = MIN(percent, 255); + tmp64 = (uint64_t)duty * 255; + do_div(tmp64, duty100); + *speed = MIN((uint32_t)tmp64, 255); return 0; } Patches currently in stable-queue which might be from alexander.deucher@xxxxxxx are queue-6.1/revert-drm-amdgpu-revert-drm-amdgpu-getting-fan-speed-pwm-for-vega10-properly.patch queue-6.1/drm-amdgpu-fixed-bug-on-error-when-unloading-amdgpu.patch queue-6.1/drm-optimize-drm-buddy-top-down-allocation-method.patch queue-6.1/drm-amd-display-move-remaining-fpu-code-to-dml-folder.patch queue-6.1/drm-amd-pm-correct-the-reference-clock-for-fan-speed-rpm-calculation.patch queue-6.1/drm-amd-pm-smu13-baco-is-supported-when-it-s-in-baco-state.patch queue-6.1/drm-amd-pm-add-the-missing-mapping-for-ppt-feature-on-smu13.0.0-and-13.0.7.patch queue-6.1/drm-amd-delay-removal-of-the-firmware-framebuffer.patch