<div dir="ltr"><div><div>Hello,<br>Can you write here your card name and firmware version? Without this patch, my fan sensors are broken, and it's sensitive to my pc case with water cooling.<br>My card is:  Sapphire Pulse Radeon RX Vega 56  vd6546 SA<br>lspci name: [AMD/ATI] Vega 10 XL/XT [Radeon RX Vega 56/64] (rev c3)<br>Firmware: ATOM BIOS: 113-376XL-UO2<br>This patch is 100% working correct on my machine, and I tested it last 2 months.<br><br></div><div>Regards,<br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 14, 2022 at 1:15 PM Asher Song <<a href="mailto:Asher.Song@amd.com">Asher.Song@amd.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This reverts commit fe01cb24b81c0091d7e5668874d51ce913e44a97.<br>
<br>
Unfortunately, that commit causes fan monitors can't be read and written<br>
properly.<br>
<br>
Signed-off-by: Asher Song <<a href="mailto:Asher.Song@amd.com" target="_blank">Asher.Song@amd.com</a>><br>
---<br>
 .../amd/pm/powerplay/hwmgr/vega10_thermal.c   | 25 ++++++++++---------<br>
 1 file changed, 13 insertions(+), 12 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_thermal.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_thermal.c<br>
index 190af79f3236..dad3e3741a4e 100644<br>
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_thermal.c<br>
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_thermal.c<br>
@@ -67,21 +67,22 @@ int vega10_fan_ctrl_get_fan_speed_info(struct pp_hwmgr *hwmgr,<br>
 int vega10_fan_ctrl_get_fan_speed_pwm(struct pp_hwmgr *hwmgr,<br>
                uint32_t *speed)<br>
 {<br>
-       struct amdgpu_device *adev = hwmgr->adev;<br>
-       uint32_t duty100, duty;<br>
-       uint64_t tmp64;<br>
+       uint32_t current_rpm;<br>
+       uint32_t percent = 0;<br>
<br>
-       duty100 = REG_GET_FIELD(RREG32_SOC15(THM, 0, mmCG_FDO_CTRL1),<br>
-                               CG_FDO_CTRL1, FMAX_DUTY100);<br>
-       duty = REG_GET_FIELD(RREG32_SOC15(THM, 0, mmCG_THERMAL_STATUS),<br>
-                               CG_THERMAL_STATUS, FDO_PWM_DUTY);<br>
+       if (hwmgr->thermal_controller.fanInfo.bNoFan)<br>
+               return 0;<br>
<br>
-       if (!duty100)<br>
-               return -EINVAL;<br>
+       if (vega10_get_current_rpm(hwmgr, &current_rpm))<br>
+               return -1;<br>
+<br>
+       if (hwmgr->thermal_controller.<br>
+                       advanceFanControlParameters.usMaxFanRPM != 0)<br>
+               percent = current_rpm * 255 /<br>
+                       hwmgr->thermal_controller.<br>
+                       advanceFanControlParameters.usMaxFanRPM;<br>
<br>
-       tmp64 = (uint64_t)duty * 255;<br>
-       do_div(tmp64, duty100);<br>
-       *speed = MIN((uint32_t)tmp64, 255);<br>
+       *speed = MIN(percent, 255);<br>
<br>
        return 0;<br>
 }<br>
-- <br>
2.25.1<br>
<br>
</blockquote></div>