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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DBCE0C433EF for ; Tue, 12 Apr 2022 00:51:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 360DD10FB1C; Tue, 12 Apr 2022 00:51:20 +0000 (UTC) Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id D1AB810FB1E for ; Tue, 12 Apr 2022 00:51:18 +0000 (UTC) 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 ams.source.kernel.org (Postfix) with ESMTPS id 7ECF1B819A7; Tue, 12 Apr 2022 00:51:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55137C385AB; Tue, 12 Apr 2022 00:51:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649724676; bh=Qem81bJBJ4bXuldztS3i1EFkoRvyIMTGFYIioO0Ei+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rgHpWfl4zoRwrXkX9yMzOD6N1iY0WDbYz0CJN9Me3pSM/zbvSlMf5IjeaM4YTxhvI INs+tRa6vrFsz7EdmEfHJ4RFfvx5PSTCpOmv/4Zuamcb1p2iSvug+IJuHKntarg6Ys VbmWNGybUry+GyKSq1QDB+Ns/0WhiPMoDvYrZf36bTvu7H80HLcpfKoG3GrfW/SFQu JcU26/pPlwQZpBQlZdCiPJtI7nAG9uqhp4azeyAB9h7w8nR9M1ok5Z/XPiccdtipVN HuswrDBm3b2m3f4oM0lUnT4PV2tUR2rqZHZdSBRz2T8SIALHVh0Dnl5RPgII8TONQ5 0osdVolVIWehw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 11/21] gpu: ipu-v3: Fix dev_dbg frequency output Date: Mon, 11 Apr 2022 20:50:30 -0400 Message-Id: <20220412005042.351105-11-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220412005042.351105-1-sashal@kernel.org> References: <20220412005042.351105-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sasha Levin , Leo Ruan , airlied@linux.ie, dri-devel@lists.freedesktop.org, Mark Jonas Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Leo Ruan [ Upstream commit 070a88fd4a03f921b73a2059e97d55faaa447dab ] This commit corrects the printing of the IPU clock error percentage if it is between -0.1% to -0.9%. For example, if the pixel clock requested is 27.2 MHz but only 27.0 MHz can be achieved the deviation is -0.8%. But the fixed point math had a flaw and calculated error of 0.2%. Before: Clocks: IPU 270000000Hz DI 24716667Hz Needed 27200000Hz IPU clock can give 27000000 with divider 10, error 0.2% Want 27200000Hz IPU 270000000Hz DI 24716667Hz using IPU, 27000000Hz After: Clocks: IPU 270000000Hz DI 24716667Hz Needed 27200000Hz IPU clock can give 27000000 with divider 10, error -0.8% Want 27200000Hz IPU 270000000Hz DI 24716667Hz using IPU, 27000000Hz Signed-off-by: Leo Ruan Signed-off-by: Mark Jonas Reviewed-by: Philipp Zabel Signed-off-by: Philipp Zabel Link: https://lore.kernel.org/r/20220207151411.5009-1-mark.jonas@de.bosch.com Signed-off-by: Sasha Levin --- drivers/gpu/ipu-v3/ipu-di.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/ipu-v3/ipu-di.c b/drivers/gpu/ipu-v3/ipu-di.c index b4a31d506fcc..74eca68891ad 100644 --- a/drivers/gpu/ipu-v3/ipu-di.c +++ b/drivers/gpu/ipu-v3/ipu-di.c @@ -451,8 +451,9 @@ static void ipu_di_config_clock(struct ipu_di *di, error = rate / (sig->mode.pixelclock / 1000); - dev_dbg(di->ipu->dev, " IPU clock can give %lu with divider %u, error %d.%u%%\n", - rate, div, (signed)(error - 1000) / 10, error % 10); + dev_dbg(di->ipu->dev, " IPU clock can give %lu with divider %u, error %c%d.%d%%\n", + rate, div, error < 1000 ? '-' : '+', + abs(error - 1000) / 10, abs(error - 1000) % 10); /* Allow a 1% error */ if (error < 1010 && error >= 990) { -- 2.35.1