Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu/soc21: fix xclk for APUs

The reference clock is supposed to be 100Mhz, but it
appears to actually be slightly lower (99.81Mhz).

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14451
Reviewed-by: Jesse Zhang <Jesse.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 637fee3954d4bd509ea9d95ad1780fc174489860)
Cc: stable@vger.kernel.org

+7 -1
+7 -1
drivers/gpu/drm/amd/amdgpu/soc21.c
··· 225 225 226 226 static u32 soc21_get_xclk(struct amdgpu_device *adev) 227 227 { 228 - return adev->clock.spll.reference_freq; 228 + u32 reference_clock = adev->clock.spll.reference_freq; 229 + 230 + /* reference clock is actually 99.81 Mhz rather than 100 Mhz */ 231 + if ((adev->flags & AMD_IS_APU) && reference_clock == 10000) 232 + return 9981; 233 + 234 + return reference_clock; 229 235 } 230 236 231 237