Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1930101pxu; Sun, 13 Dec 2020 07:57:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJzO0E567i3xWsXvVxVe3zuTKFUDcUpX2KOmJkHC4BaVX8WIotZFMY/+RC/ZhRyPspNfLY2t X-Received: by 2002:a17:906:fa88:: with SMTP id lt8mr19337233ejb.408.1607875021257; Sun, 13 Dec 2020 07:57:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607875021; cv=none; d=google.com; s=arc-20160816; b=OxrrEpi6IUXsBcFzA735dQu/v3xflwyl9yf9itg+nyqcmxdP3sHQOE2aR0XoL/edZ+ 1ZXw6OeTFAsNSQDQmYLAn4SZHK2O9S5iZdWsVYY+p1wo1oucBt+wtCuCHSLqFcVEiC1A +3zwBvk4fb4GfM4XSYc898Isv96zpMPtPoLyKIfM/msZNxbjUicehEu/WKhTrvotEB1P jojEM7QJvHlS7Vkv0RTypkipmw10OFICcPyTMZn+BhDzg/pIeaL8/N4+jJkBv8V1UgDm 2BJhFl5b7Xy3CqdAB3N37HYQZcn/N3NkXGPYoKvMAVo++H682n7UO1k8eLwnBSs8kzYe JAKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=gDr2YjhT1TUQCr937YZs66Q5FRlwH3CB0K8UO5nqGyg=; b=AGXIFliOLQ3Y644EC/VkdxPr6KSKvChrOjP7Glw09iRLYGnOOzg2YwQUHXvSAOnff1 053RLG9sk4DPTDTv2q642lu+yYYG2+dRh6hineDMDdBnc85UbRxIiUroZI25CUSqRWEB seiWRq8wUYOJd3PLjEmFwuDssuqfABCI1F/2May6/xX+tMhTtAbg+0Qpz/DPjU+isao5 5EcS0wS6fsW6oXx4czuUCck+1Bz1FNj1Mnml+I180P3FDIEpFx0R53jzz02PiMGBHao2 xYVejMFsCxUp32rOZectWvIbCEieCW3v2KNrFZedw4n/ooAwKXOvkzf1bCQrjVgK5PgM kXUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bt28si8822760edb.269.2020.12.13.07.56.39; Sun, 13 Dec 2020 07:57:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407457AbgLLQLr (ORCPT + 99 others); Sat, 12 Dec 2020 11:11:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:57714 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439407AbgLLQJ4 (ORCPT ); Sat, 12 Dec 2020 11:09:56 -0500 From: Sasha Levin Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Brandon Syu , Tony Cheng , Aurabindo Pillai , Alex Deucher , Sasha Levin , dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 5.9 20/23] drm/amd/display: Init clock value by current vbios CLKs Date: Sat, 12 Dec 2020 11:08:01 -0500 Message-Id: <20201212160804.2334982-20-sashal@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201212160804.2334982-1-sashal@kernel.org> References: <20201212160804.2334982-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Brandon Syu [ Upstream commit 7e0b367db85ef7b91399006253759a024eab7653 ] [Why] While booting into OS, driver updates DPP/DISP CLKs. But init clock value is zero which is invalid. [How] Get current clocks value to update init clocks. To avoid underflow. Signed-off-by: Brandon Syu Reviewed-by: Tony Cheng Acked-by: Aurabindo Pillai Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- .../drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c index 2f8fee05547ac..c001307b0a59a 100644 --- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c @@ -163,8 +163,17 @@ void rn_update_clocks(struct clk_mgr *clk_mgr_base, new_clocks->dppclk_khz = 100000; } - if (should_set_clock(safe_to_lower, new_clocks->dppclk_khz, clk_mgr->base.clks.dppclk_khz)) { - if (clk_mgr->base.clks.dppclk_khz > new_clocks->dppclk_khz) + /* + * Temporally ignore thew 0 cases for disp and dpp clks. + * We may have a new feature that requires 0 clks in the future. + */ + if (new_clocks->dppclk_khz == 0 || new_clocks->dispclk_khz == 0) { + new_clocks->dppclk_khz = clk_mgr_base->clks.dppclk_khz; + new_clocks->dispclk_khz = clk_mgr_base->clks.dispclk_khz; + } + + if (should_set_clock(safe_to_lower, new_clocks->dppclk_khz, clk_mgr_base->clks.dppclk_khz)) { + if (clk_mgr_base->clks.dppclk_khz > new_clocks->dppclk_khz) dpp_clock_lowered = true; clk_mgr_base->clks.dppclk_khz = new_clocks->dppclk_khz; update_dppclk = true; -- 2.27.0