[AMD Public Use] As crystal clock is not guaranteed to be 100M always, it's better to hardcode to 25M. Thanks, Lijo -----Original Message----- From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of Quan, Evan Sent: Wednesday, January 27, 2021 9:16 AM To: Alex Deucher <alexdeucher@xxxxxxxxx>; amd-gfx@xxxxxxxxxxxxxxxxxxxxx Cc: Deucher, Alexander <Alexander.Deucher@xxxxxxx> Subject: RE: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback [AMD Official Use Only - Internal Distribution Only] [AMD Official Use Only - Internal Distribution Only] Actually after switching to retrieve fan speed from metrics table always, this API is not used any more. Maybe we can just drop it. Either way the patch is reviewed-by: Evan Quan <evan.quan@xxxxxxx> BR Evan -----Original Message----- From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of Alex Deucher Sent: Wednesday, January 27, 2021 2:17 AM To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx Cc: Deucher, Alexander <Alexander.Deucher@xxxxxxx> Subject: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback The xclk needs to be divided by 4. Fixes: acab02c1af43d3 ("drm/amdgpu/pm/smu11: Fix fan set speed bug") Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx> --- drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c index 147efe12973c..36dac106ed4b 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c @@ -1245,7 +1245,11 @@ int smu_v11_0_get_fan_speed_rpm(struct smu_context *smu, if (!tach_period) return -EINVAL; -crystal_clock_freq = amdgpu_asic_get_xclk(adev); +/* + * crystal_clock_freq div by 4 is required since the fan control + * module refers to 25MHz + */ +crystal_clock_freq = amdgpu_asic_get_xclk(adev) / 4; tmp64 = (uint64_t)crystal_clock_freq * 60 * 10000; do_div(tmp64, (tach_period * 8)); -- 2.29.2 _______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Clijo.lazar%40amd.com%7Ccacc23400e334530b87208d8c2760341%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637473159427515107%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=7xQ9%2BLQ8O%2FiLSkGngF%2BYHqleC6WKAJ2aLHe3Vts%2BTts%3D&reserved=0 _______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Clijo.lazar%40amd.com%7Ccacc23400e334530b87208d8c2760341%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637473159427515107%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=7xQ9%2BLQ8O%2FiLSkGngF%2BYHqleC6WKAJ2aLHe3Vts%2BTts%3D&reserved=0 _______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/amd-gfx