From patchwork Tue Sep 20 12:50:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12982097 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 3B67EECAAD8 for ; Tue, 20 Sep 2022 12:55:16 +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=MoLir3vRpPkmOzYhLOV9ubqXGc4gcJ+nepAP378662w=; b=XczK3EjyPOxFfj YooSv7iRqAMTFCj2T6VsC8RvYywwAOnUWdGLyB04aeV6Tbz6ghsSzq4m1w9j4X3MSib/I1weaWksH F+BfS+yoWwYp26Juaunc5s3hVRfRgsdW22S6qcowjqRPrYOvJaiRR72ElPLAmV6XPWqBpMq9977pp QjVmbUEG1DImn6p5OI1vUi8snK1qyON79csji+yenVGeM+J5AUBqi4Xd+CprUhVmr16YiQv/5iXvx Aknq37bAkzZNtKDpUjj65vimO53SqxHLAZjS5Sj1WdGcQvtbB8DspD3oWmqpksoBxeOt3gy9F27sl DSdXPpUh3ebh9cuASy2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oaclQ-003qSr-43; Tue, 20 Sep 2022 12:54:12 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oackR-003pun-Pi; Tue, 20 Sep 2022 12:53:13 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 7921F3200A0C; Tue, 20 Sep 2022 08:53:09 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Tue, 20 Sep 2022 08:53:11 -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=fm2; t=1663678388; x= 1663764788; bh=5Cc2S/zQVAffcAyuSwlU7SwrejWyJZT6LOsl2nIBccg=; b=x HZjhJACzsIjchHSoEGtKM6fih5rcS5UMLXhA0VKE31Y68n0cAsamtdckte7qOnyY n/yWS/roxQ1yulD10fHE+wECaFgWi3y0UsLQamEPeALq5ei1ror/+Qq/iYhdkiA9 dAh87iCaQbIIQRi+CuiyvUMUMDDBrnqLDC981nprQiNIJj36PmFUM1sbGNI2MKu3 yNehaS0UVwWXlgfC5qVQcpickyt9DNcVrILZdl8gw4wLCEM0tycUVjFsSa6tfRH+ MLJN8QVXViLvwtoODebxg/j0oFzpFqjPX9a8224hbSfKtqaGa/Q/ZGtyqcKjIiMc mdew2Y8O8fogRr0hisW6g== 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=fm2; t=1663678388; x= 1663764788; bh=5Cc2S/zQVAffcAyuSwlU7SwrejWyJZT6LOsl2nIBccg=; b=S lqnTfqSEvCr0p5IJGeT/GzosqpnyB5qoI/2iILg8r/9mvaqvs8I3+b6q648d6bjr EmnOj9jSXHRgH4V4Dv+bmw/N1LhdTC26ljJJNJZwTGI7QjqAgF11TUXJHN9s6J4q BpjFa44qlvMoWQ9QBRgpqJE2XoR5QsGrb65rk3N7KnnPNvdr8MA56XR9NqSprBA3 EsG7YmM5C0qSg4T9F74JqaXIyWxHoSj6CWvarcriqaGs33YLZC3vCmHYgyVQbPqT djSmdSU7/nTX2HjopwV1sVRxrHnkRqty32ykzvtZFZn4VV+gJXsm9rsAhLlTiMP4 rimChMMpqKgQZ+Yt2PPTQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfedvledgheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephfffufggtgfgkfhfjgfvvefosehtkeertdertdejnecuhfhrohhmpeforgig ihhmvgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrf grthhtvghrnhepudduudfhveejteefgedvffdvvedvjedugedukeejhedtlefhffevtefh jeeltdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 20 Sep 2022 08:53:08 -0400 (EDT) From: Maxime Ripard Date: Tue, 20 Sep 2022 14:50:23 +0200 Subject: [PATCH v2 4/7] drm/vc4: hdmi: Fix hdmi_enable_4kp60 detection MIME-Version: 1.0 Message-Id: <20220815-rpi-fix-4k-60-v2-4-983276b83f62@cerno.tech> References: <20220815-rpi-fix-4k-60-v2-0-983276b83f62@cerno.tech> In-Reply-To: <20220815-rpi-fix-4k-60-v2-0-983276b83f62@cerno.tech> To: Daniel Vetter , Florian Fainelli , David Airlie , Broadcom internal kernel review list , Michael Turquette , Scott Branden , Stephen Boyd , Emma Anholt , Ray Jui , Maxime Ripard Cc: linux-rpi-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Dom Cobley , dri-devel@lists.freedesktop.org, Maxime Ripard , linux-arm-kernel@lists.infradead.org X-Mailer: b4 0.10.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1808; i=maxime@cerno.tech; h=from:subject:message-id; bh=XWjpwgSgO/e0xPKi2xqW6eLYT6GXogPpdSxziMgFD2I=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMma2/mquKa7py22cvVg/X7IJKx/58+QJZqBVl735mTIz2LK aJfpKGVhEONikBVTZIkRNl8Sd2rW6042vnkwc1iZQIYwcHEKwEQ+uDEybBB4kDk3l9POjIuv7YFBxU nvDl2P2XJMr7pfvvtwm7ffgeGf3utpwvJyBrNvfnN4/2m37gvZG1Nu6RYXv36x4bgKc+VzRgA= 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-20220920_055311_889553_EC8FFF65 X-CRM114-Status: GOOD ( 11.92 ) 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 1e5f68704d7d..3b75ac6fa0db 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;