From patchwork Mon Aug 15 15:31:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12943739 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 54294C00140 for ; Mon, 15 Aug 2022 15:35:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vlq/CuuPgipy+/cQ6tMHZgrmvbf4d2C1py0AOt1Z1Os=; b=5BWAYP6XO8SjNc Wd8/X5mx6KpwKtcmwr6QdSJmXzFw2VEFGapf85xnfKX3fPs3aImvpDRaGMuGCyttVZ6v3E0EML4es wZ5DibcX9V5MfWmpEgzojwBG9GQgOHvOdqWhv7DOogWoXZ95PFh6SfUySLotFSiASabU89z4K+Kwh CpR7iD1e788YOG6uXmTyw4tnQwq8IJhN0Ni+q+OrN+grrc9g1iy7G0XE7I7N2+YCcALTp+Y/mGW2P LoH/JI66ThNqTm1GwfE2or/wIbW2JiRLJiiK41164AxGn/B+OoOR33/nJP1qaE9RmwmsHkqGcdEcL /QHmLw9vEh4qWO82btSQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oNc6m-000vdW-SO; Mon, 15 Aug 2022 15:34:29 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oNc4L-000u34-Rt; Mon, 15 Aug 2022 15:31:59 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id BF6793200904; Mon, 15 Aug 2022 11:31:55 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 15 Aug 2022 11:31:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1660577515; x= 1660663915; bh=vhRyXQqISjoh2e7pk/F7Qvq1OW7LWLQLkUXMxS8tBmU=; b=K 7GTLnMsU5E+bUwUJznMdn2JkicORd839JUwoJ1rWqF5DSDJKuK5fY2wsvw3iaS2K vfK5UKgmDROHDJdyUVG0xymVaIa0lo1OA7oekdRI8VAQKM76bhOrT5o7M6xAlvrM 2bVa5lB6NEZfHRFEDhr0xtHab49aCb98AeOOGwyt1xYymqXM54CPJHKx6xMksgWe /QFgV5zbzTcs02/rolYN0sVCubVBWUSTYD7L5tSlyDyc6FQUTfP+Ls6Io8Q0q8lG 7MUHWOZqCCrgyZ4Kq+9n+g/9DlZd2vLt2+Q3SeO9koIls+stEGio6LOcMExow5HB 1Ob6VsmGhegGaqscMkWSA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1660577515; x= 1660663915; bh=vhRyXQqISjoh2e7pk/F7Qvq1OW7LWLQLkUXMxS8tBmU=; b=R lD1gwhMfRtlNxJdxjZiEuX0Ka125BYvyhsQv7PlVarTHxsvsnPRivGIoGHyUolL4 2oCZ7NW6A8dVVAhth4vNO58ANCT4lMxdNZ27VXWyQokZ8kF4IF1zMTWgrV97K2Wf Egn46eQJOxP35NVkthT4W+gcNrMtJidPLfArHSGMSwiOMQMb5uvHmjHobOYcSaLZ 0KJiLuasedFQN5fVngUYaVVA/+2VubM8cQJIN6WeX1tYkeTruoLp1xVvQz17G9PT 0vrf1wIbSIshMrvUZYVhyKoRnqTgpaNUtB4Bk0OdJp2iFd7dQkIQwQ5C59kJiFht UDJy05PbuXfLzZgSuGLpg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdehvddgleduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthekredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpefgfffgteffuddulefhveeiffffudelvefggeekueetgfffjeehleel keejfefhjeenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 15 Aug 2022 11:31:54 -0400 (EDT) From: Maxime Ripard To: Michael Turquette , Ray Jui , Broadcom internal kernel review list , Florian Fainelli , David Airlie , Daniel Vetter , Stephen Boyd , Scott Branden , Maxime Ripard , Emma Anholt Cc: Maxime Ripard , linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, Dom Cobley , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 4/7] drm/vc4: hdmi: Fix hdmi_enable_4kp60 detection Date: Mon, 15 Aug 2022 17:31:26 +0200 Message-Id: <20220815-rpi-fix-4k-60-v1-4-c52bd642f7c6@cerno.tech> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220815-rpi-fix-4k-60-v1-0-c52bd642f7c6@cerno.tech> References: <20220815-rpi-fix-4k-60-v1-0-c52bd642f7c6@cerno.tech> MIME-Version: 1.0 X-Mailer: b4 0.10.0-dev-a76f5 X-Developer-Signature: v=1; a=openpgp-sha256; l=1818; i=maxime@cerno.tech; h=from:subject:message-id; bh=0XTcURUE3scuqpvcocFWLSNEWe2VrFtmV9qgTsz3u18=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDEm/0k4cTT3wx+IJm2tUxjNuLr1Hqz3mnnQ4H3Fx86zign/1 R+UEOkpZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjCRFRaMDBdLyjbcyuJRf7vuXpv1qw 8JgT+f28zTU/QPV2C2dLk0SYORYUX5DLmJhc0rVc6l9JpWXfzssnTJwxnbn6atuLoh+9R2CzYA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220815_083158_035609_3595B50A X-CRM114-Status: GOOD ( 12.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In order to support higher HDMI frequencies, users have to set the hdmi_enable_4kp60 parameter in their config.txt file. We were detecting this so far by calling clk_round_rate() on the core clock with the frequency we're supposed to run at when one of those modes is enabled. Whether or not the parameter was enabled could then be inferred by the returned rate since the maximum clock rate reported by the firmware was one of the side effect of setting that parameter. However, the recent clock rework we did changed what clk_round_rate() was returning to always return the minimum allowed, and thus this test wasn't reliable anymore. Let's use the new clk_get_max_rate() function to reliably determine the maximum rate allowed on that clock and fix the 4k@60Hz output. Fixes: e9d6cea2af1c ("clk: bcm: rpi: Run some clocks at the minimum rate allowed") Signed-off-by: Maxime Ripard diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 592c3b5d03e6..aa3ebda55e04 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -2966,7 +2967,7 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) if (variant->max_pixel_clock == 600000000) { struct vc4_dev *vc4 = to_vc4_dev(drm); - long max_rate = clk_round_rate(vc4->hvs->core_clk, 550000000); + unsigned long max_rate = rpi_firmware_clk_get_max_rate(vc4->hvs->core_clk); if (max_rate < 550000000) vc4_hdmi->disable_4kp60 = true;