From patchwork Thu Oct 20 09:12:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13012881 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 4DB74C4332F for ; Thu, 20 Oct 2022 09:19:09 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=r5g+5WEAUvPdEvd+frcxa70NXguDaq2Y/7G9IzFmzPc=; b=azhPHEnqaktq6t zYhdhDrC6JzcLrRxj5dUHZn2Ei27+NvZ3fXhoJHg8iRcbFqBeRX2aidvlzpn46xIyXQQiYdxqo36T gguwgY/bmbK2sJjDNxLmGsi9+GleIctxtTGaQtPHJhhRTMZQ+QTrDqGzMEplYIWKklgz28hStzssF PBVrAC0eDj7V/GqBVng2n4M+x/T9gkdDE4K/vh2/pZ9P/JZi5ycuL5P3MmskWXXpa/UEZMdZPQcfm 6ruwfkTsAVBdPhB1svkufTspb6yg+Q8H//l2a4BUBPyRHTN7CjuvbzxyDt3KLjU0Kkv9fMIVihDBo RWAeKt/tq1dAQLTrkzmA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1olRgI-00Cpnx-OU; Thu, 20 Oct 2022 09:17:39 +0000 Received: from wnew2-smtp.messagingengine.com ([64.147.123.27]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1olRcV-00Cmxc-3c; Thu, 20 Oct 2022 09:13:46 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id C37A52B05D99; Thu, 20 Oct 2022 05:13:39 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Thu, 20 Oct 2022 05:13:42 -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=1666257219; x= 1666264419; bh=R9HharCQOI9TrJb7L8LG1ocNL0PwXIwue7dcYvnXGEI=; b=P 6E14VtcV4tD4OHapRYW1LQXA2qEoPTFsRT0tCxyATp4fCtFUnH4Ubslomc3ArezC TtP0ouQEf+Co1coPtjFwYR2bLqOCSdNxZ05CatpiJ7cZmKV0UJYYeFpUdYRbEy1+ RFQ8obhgceNnEQtDcsxVWYwfVwpo5lqkP5Xdm9RLWP/Aa4qQgSupV4FBcIlHBnkk o1rjuBpNB7Mz0Mf2MaxlEKmTr7eoHkNy2eZX/mi3JOVwEJOtDbyezPsxRTUQJLbI 7QDSrlBInnAdgRS4BQIExBIkrqDX0ouabfrTPNv3Ja4M8Epk5I6FUKxToiiY6I5m 7zcyIL9pu3EiouQSaWpvg== 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=fm3; t=1666257219; x= 1666264419; bh=R9HharCQOI9TrJb7L8LG1ocNL0PwXIwue7dcYvnXGEI=; b=E UhuMgTLVUlMJX/vkOmRLo4UAcodx9cJzfthoGQGlrr8q9rh1mCMN3iBtlk0jmfIk UH2o/bjkosD62d5dYt7bE0eTOKL0mebB7L6vwqlEuaKGUlxr6+XbgqMG6/ARDEid lbZea53mRisxsk0PBxOGrn+r6uedGW9b8IuMKaVo5yysqQ+4e08ZtpjIh2pJO+1u 2Xvtv452d9UTdVCo3PPxRlx8HLm9kbbrhubQ/RMthb17KWx5z/VhJl9fxc1xhB3N UjfAeD0FmOar8fUDEsNUNo1ZNXUT0pYnyIgzR6NvUuDlL9xMY3qdbp20ClxkZV1H /20pcSRftyKED30ehVFwA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeeliedgudefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephfffufggtgfgkfhfjgfvvefosehtkeertdertdejnecuhfhrohhmpehmrgig ihhmvgestggvrhhnohdrthgvtghhnecuggftrfgrthhtvghrnhepfeduhfegveehhfeftd euveeuleduuddttedutddvvdegkeehleevhfetkeetiefhnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordhtvg gthh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 20 Oct 2022 05:13:38 -0400 (EDT) From: maxime@cerno.tech Date: Thu, 20 Oct 2022 11:12:12 +0200 Subject: [PATCH v4 4/7] drm/vc4: hdmi: Fix hdmi_enable_4kp60 detection MIME-Version: 1.0 Message-Id: <20220815-rpi-fix-4k-60-v4-4-a1b40526df3e@cerno.tech> References: <20220815-rpi-fix-4k-60-v4-0-a1b40526df3e@cerno.tech> In-Reply-To: <20220815-rpi-fix-4k-60-v4-0-a1b40526df3e@cerno.tech> To: Daniel Vetter , Emma Anholt , Michael Turquette , Stephen Boyd , Maxime Ripard , Ray Jui , Florian Fainelli , David Airlie , Broadcom internal kernel review list , Scott Branden Cc: Stefan Wahren , Maxime Ripard , linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, Dom Cobley , linux-rpi-kernel@lists.infradead.org X-Mailer: b4 0.10.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1903; i=maxime@cerno.tech; h=from:subject:message-id; bh=Po/0zWeG0J9jRRowzpJU7mdz3tNlPWD94CHiLGqKoOU=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmBAq8WZaV4Ltdy2HTqus7G+QFxGto/lu9ZKXNPPSPFkvGr jI59RykLgxgXg6yYIkuMsPmSuFOzXney8c2DmcPKBDKEgYtTACbitJ+RofNDwr0NE4oXiKxamPc8Lc hb6uKmR9lpC/qknU2zVnYEH2T4K3X1QjJfxtPIi91ziiQWyZ04N9XUw0E5ImCSH/P+mutr+AA= 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-20221020_021343_316989_56010A7E X-CRM114-Status: GOOD ( 14.19 ) 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 Reviewed-by: Dave Stevenson --- drivers/gpu/drm/vc4/vc4_hdmi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 64f9feabf43e..87961d4de5aa 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 @@ -3429,7 +3430,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;