From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51488C7EE45 for ; Mon, 12 Jun 2023 10:44:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229777AbjFLKoi (ORCPT ); Mon, 12 Jun 2023 06:44:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234050AbjFLKoW (ORCPT ); Mon, 12 Jun 2023 06:44:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 836DB3C15 for ; Mon, 12 Jun 2023 03:29:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6109860C2D for ; Mon, 12 Jun 2023 10:29:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78074C433D2; Mon, 12 Jun 2023 10:29:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1686565746; bh=pqBGfxUzFxFMmgWEbXuVrmXQEVAxxV/dTRkTVZMPCUY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SuL4UwA5p3A1WPU/+c6IdmK67XvJ39qzidRPCaVPZNizPE8G8pYC8SpRzOE5TXxHk NtJCByFwKYtP4e4TigLmD8j/erfBv9d6m6SAiCULfvL04TFkGH29nKWUWA40koFgDW tzLbJpMWidupwUFwhDNJbNNfQLYPGtI9/3y7mw+c= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Chia-I Wu , Alex Deucher Subject: [PATCH 4.14 14/21] drm/amdgpu: fix xclk freq on CHIP_STONEY Date: Mon, 12 Jun 2023 12:26:09 +0200 Message-ID: <20230612101651.546930221@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612101651.048240731@linuxfoundation.org> References: <20230612101651.048240731@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Chia-I Wu commit b447b079cf3a9971ea4d31301e673f49612ccc18 upstream. According to Alex, most APUs from that time seem to have the same issue (vbios says 48Mhz, actual is 100Mhz). I only have a CHIP_STONEY so I limit the fixup to CHIP_STONEY Signed-off-by: Chia-I Wu Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/vi.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/amd/amdgpu/vi.c +++ b/drivers/gpu/drm/amd/amdgpu/vi.c @@ -327,8 +327,15 @@ static u32 vi_get_xclk(struct amdgpu_dev u32 reference_clock = adev->clock.spll.reference_freq; u32 tmp; - if (adev->flags & AMD_IS_APU) - return reference_clock; + if (adev->flags & AMD_IS_APU) { + switch (adev->asic_type) { + case CHIP_STONEY: + /* vbios says 48Mhz, but the actual freq is 100Mhz */ + return 10000; + default: + return reference_clock; + } + } tmp = RREG32_SMC(ixCG_CLKPIN_CNTL_2); if (REG_GET_FIELD(tmp, CG_CLKPIN_CNTL_2, MUX_TCLK_TO_XCLK))