drm/amd/pm: correct the reference clock for fan speed(rpm) calculation
authorjsg <jsg@openbsd.org>
Thu, 19 Jan 2023 00:03:51 +0000 (00:03 +0000)
committerjsg <jsg@openbsd.org>
Thu, 19 Jan 2023 00:03:51 +0000 (00:03 +0000)
From Evan Quan
b435f68e415ca5e17e3425893ea991720a43b595 in linux-6.1.y/6.1.7
6fea87637bf36bd285227f490132e83582ab7513 in mainline linux

sys/dev/pci/drm/amd/pm/swsmu/smu13/smu_v13_0.c

index 2559119..a694a8e 100644 (file)
@@ -1258,7 +1258,8 @@ int smu_v13_0_set_fan_speed_rpm(struct smu_context *smu,
                                uint32_t speed)
 {
        struct amdgpu_device *adev = smu->adev;
-       uint32_t tach_period, crystal_clock_freq;
+       uint32_t crystal_clock_freq = 2500;
+       uint32_t tach_period;
        int ret;
 
        if (!speed)
@@ -1268,7 +1269,6 @@ int smu_v13_0_set_fan_speed_rpm(struct smu_context *smu,
        if (ret)
                return ret;
 
-       crystal_clock_freq = amdgpu_asic_get_xclk(adev);
        tach_period = 60 * crystal_clock_freq * 10000 / (8 * speed);
        WREG32_SOC15(THM, 0, regCG_TACH_CTRL,
                     REG_SET_FIELD(RREG32_SOC15(THM, 0, regCG_TACH_CTRL),