From patchwork Thu Oct 13 09:13:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13005780 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 087D9C433FE for ; Thu, 13 Oct 2022 09:15:02 +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=uHhvkBSgna6uQxirSta2Bjk3pj/5zA1v88vWi0y/57Y=; b=pCKVM0Q6s8Pqpm qXrHLcn2z8y/GqAkAp4LrM6UmZytkobF783ITLNLrfrH4pSkaGuUSulXpKMeJn2aFzFFW7V8GVObt 0Z+84/hpT5b+W0w6qbpSsNIOAR9JXJT714v1YC1BDFi2yrcBBoRut0zeoRN5QCZU+q/lVnMxxofiz xDbIrRY0zEh+XZmbjrFHuDgsS35FOycctw+QgmWNWhCRX2PiVH6W/MQStbH+HkHw6IHC3CNGjIzeU y3BtlQViEsFYLdelpQWu3gtCLn6Ng2OpYnDfKLXRINLw03y2xdRvK31tf/cqMM0eAgEUCZTycZ1gO T4UieRVqndjPAuj5rVJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oiuHu-00BEfD-Ee; Thu, 13 Oct 2022 09:13:58 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oiuHI-00BEPu-3b; Thu, 13 Oct 2022 09:13:21 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 7F4375C00EE; Thu, 13 Oct 2022 05:13:19 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Thu, 13 Oct 2022 05:13:19 -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=1665652399; x= 1665738799; bh=ZQjFpYF4e0Dy/cWO7rqPvZZq5y+2aveHJD01sKou3PU=; b=y cebru2AvS8YSPHdZivIu35r08q7j5b0spf7C2/oPrjCXnSPNwTe32zs7h8+CSW4N uC4pNldahFzjVWhzMkVvIOg0Zt9rxNMREr3pTZXS6o0X0IoCEOXhOdBQkY4MaVIv nERnRt16WNUhv2+k84DHjxJis9PTxACkchZfTD/ohIFT7uyY6JbR8GDMGA0ctluM jT7O5Jocer5xv1LHdk3qYvTt/KfkjjveiMgl7qAmqiCOkLjQHmHGLjJhL5nDzxwt 97a2SOoAArQplSz8sfdbmaQg7M8TpLZ58tXwCiqbOoZ/akdfwP4MXvOVHTiUiVbg xQ/LaeQKz4R0DcoWcEfHw== 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=1665652399; x= 1665738799; bh=ZQjFpYF4e0Dy/cWO7rqPvZZq5y+2aveHJD01sKou3PU=; b=e CFacKkbVJPckcAjNKWtetOmybTV+4rF97s1DA2qsNrPa4KK3Be7hFQf/qrWjgMoU 04VvoqoBG9hhUgCYjUvPqQj64YHWqfvHR+oUrZrWYRiij0OiEDp8UN58et6muUeu HZ0daqS/a2AFa6CqeLyxl2pr/zqBUt6zX5HV0lEZCOumoKIVVeVqh4kw90qOHF/k yjqUGyrYGsjGY1SJUKqPpXCbLdM5+ejBsYcCmtOvewyxp8FUgEyMBQ2Rt7m70MAt 0JKHp/3SPeByD3bOOB5WQvISdAX+AtcEP0UIeSfmE2kTls3nO94GUQKuh4G5/mIj 4y/1YwwCIc7SN6lO96Pmg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeektddgudegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephfffufggtgfgkfhfjgfvvefosehtkeertdertdejnecuhfhrohhmpeforgig ihhmvgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrf grthhtvghrnhepudduudfhveejteefgedvffdvvedvjedugedukeejhedtlefhffevtefh jeeltdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 13 Oct 2022 05:13:18 -0400 (EDT) From: Maxime Ripard Date: Thu, 13 Oct 2022 11:13:11 +0200 Subject: [PATCH v3 4/7] drm/vc4: hdmi: Fix hdmi_enable_4kp60 detection MIME-Version: 1.0 Message-Id: <20220815-rpi-fix-4k-60-v3-4-fc56729d11fe@cerno.tech> References: <20220815-rpi-fix-4k-60-v3-0-fc56729d11fe@cerno.tech> In-Reply-To: <20220815-rpi-fix-4k-60-v3-0-fc56729d11fe@cerno.tech> To: Florian Fainelli , Michael Turquette , Emma Anholt , Stephen Boyd , Ray Jui , Scott Branden , Broadcom internal kernel review list , Daniel Vetter , David Airlie , Maxime Ripard Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Maxime Ripard , Stefan Wahren , linux-clk@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, Dom Cobley , dri-devel@lists.freedesktop.org X-Mailer: b4 0.11.0-dev-7da52 X-Developer-Signature: v=1; a=openpgp-sha256; l=1913; i=maxime@cerno.tech; h=from:subject:message-id; bh=f1lo6Ai83eEY39RwlVf8bpafgmNreYn4rcZrYcxd9Lc=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMnu15bYFYvKHn33JrTu102PFdfPm1y58np6WuKsB8lfp5Zs k59q1VHKwiDGxSArpsgSI2y+JO7UrNedbHzzYOawMoEMYeDiFICJmN5kZDg/c66DyqWv93i2ljpEBJ koGRybdOf53ffGiqeOaiwpzvjN8N+7rrvyffARowALc0e3+4uiJwpMuHpuKk+sGueEQBedCWwA 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-20221013_021320_271739_5257DE3E X-CRM114-Status: GOOD ( 13.82 ) 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 --- 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 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;