From patchwork Thu Oct 27 12:52:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13022056 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 818A0ECAAA1 for ; Thu, 27 Oct 2022 12:55:33 +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=hxNcCh7yLFFSsnOvCPDdB0Qh6Q0QgqO825BsglSc3M0=; b=XGSGxVCA5xA7JA 2Rl95+qR92TQCbKDPIOptnoZUGyL/WXre6ueq+VGgIzN2biIvmsLqZvKv9/zrnzWPu0UfGqkrSrCi mNEUUzTJm7DHFpKG4YuxrN78Pfys02BM1w2H6YofrBvm7EgxZ6mdVHo62RiheGN6RiyAfUQ2sk75Z kE1F49kQoU+0yDQIwQ/KfZ3suJNBO718bHD6/qnQtn6nWihAR5Wb6zS39pC5mKVUYkvsN3NqP3IPP VTJ1SmR0RqIJJaxkWnWrKWDGWL9xj8J9n4ntWj70ckul1EbJYO5F61AAJQd4mWbyyybCQ90bkdnMp pnA4pNxAKHUHk1u2Z0VA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oo2Op-00DFYW-LA; Thu, 27 Oct 2022 12:54:19 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oo2Ne-00DF4h-2l; Thu, 27 Oct 2022 12:53:07 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 45CDA32000EB; Thu, 27 Oct 2022 08:53:04 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 27 Oct 2022 08:53:05 -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=1666875183; x= 1666961583; bh=ABXVuFRFwD7VoP1BttJsNvCdZUJ4AkHnkkTr/OV+M3w=; b=e egEqx+P420KIQD0QnK7FGrABV2GkI/4NFblmEcca9dczDawU+tXS5CM1MrutnS4/ jDHY+r9XBTESM/SpP0Rw4t32yAhK+8WHGQ6/w1wmnWXzVqUqfqG9AimC2ULj1yjx I1a/H4pPc5D80nUcdrHDo1EZwJfPw6ENMmbFz404Qikxaxfqto1PnCgrJBwg3GwA zvj/T2qbUxC7d2sjfEGTVi5jucnd6mj8MN3pVRiJkl8EAokyy+uY7HAY1/FbmaGR XNCFQKK30P1/fkjxYOb+9w5mBpGsMOncGa3J0UXSgfS7PB8aMweor37YAId8qUSC eMsnKfkqKbooyHzthh45Q== 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=1666875183; x= 1666961583; bh=ABXVuFRFwD7VoP1BttJsNvCdZUJ4AkHnkkTr/OV+M3w=; b=l okLEfdb4VoauKaW7T1vSh8z+yOfAwl5Knp5m0zH4ulY+D6bSzQSJu5m6EU8AJit+ d6AEGo+eQReA2g1zHrNCuyFT58ED/WNWxbdCO/VhuQMCl0bIGyv77dhw0klQmIUW pb9rPTr/dXinVcK3rcqXKwwqGxKplz/1OJ2E8HfG1pENjJk9+U6uclTcayZETM0I jOhaI6RcIsZgFrohWzsaDVQK1nWXFaCqbdr/CnwczKXfQUyNdJhVwxm1wApLNNff iwOboXRM598NXFj2MdRoV8vlJIwEborZGb8YR9KBGP50sms+TdV5uUORmiHBr30P whSp/Fkbv9oucTXxLN7WQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrtdeggdehhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 27 Oct 2022 08:53:03 -0400 (EDT) From: Maxime Ripard Date: Thu, 27 Oct 2022 14:52:44 +0200 Subject: [PATCH v5 4/7] drm/vc4: hdmi: Fix hdmi_enable_4kp60 detection MIME-Version: 1.0 Message-Id: <20220815-rpi-fix-4k-60-v5-4-fe9e7ac8b111@cerno.tech> References: <20220815-rpi-fix-4k-60-v5-0-fe9e7ac8b111@cerno.tech> In-Reply-To: <20220815-rpi-fix-4k-60-v5-0-fe9e7ac8b111@cerno.tech> To: Stephen Boyd , Florian Fainelli , Maxime Ripard , Scott Branden , Broadcom internal kernel review list , Michael Turquette , Daniel Vetter , Emma Anholt , David Airlie , Ray Jui Cc: linux-rpi-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Dave Stevenson , Maxime Ripard , dri-devel@lists.freedesktop.org, Dom Cobley , linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Stefan Wahren X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=1974; i=maxime@cerno.tech; h=from:subject:message-id; bh=/rK7qcfEbvt9MabtcYvHML13bEdfRKh9F+Jr1qCrtwg=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMlR9TLLed/P8j93eGv0tB13Qo9IJzVl3ksVOOz6a9ExdYa9 CzgudpSyMIhxMciKKbLECJsviTs163UnG988mDmsTCBDGLg4BWAiGesZ/tcdWFVjdGh364Kb6kp8hv OXsTzcP+l4QJnR5KD1ml9ZWdIZ/rtq/1U7teHCfbFaedbdz27bTjE+zSAjuqe08AyLLI9FKycA 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-20221027_055306_200058_629F1EBD X-CRM114-Status: GOOD ( 13.17 ) 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") Reviewed-by: Dave Stevenson Signed-off-by: Maxime Ripard --- 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..3acc1858c55f 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 int max_rate = rpi_firmware_clk_get_max_rate(vc4->hvs->core_clk); if (max_rate < 550000000) vc4_hdmi->disable_4kp60 = true;