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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 BA637C433EF for ; Wed, 15 Dec 2021 12:44:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AFF5610ECCB; Wed, 15 Dec 2021 12:44:57 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6427F10ECCA for ; Wed, 15 Dec 2021 12:44:56 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.west.internal (Postfix) with ESMTP id D913C2B0024D; Wed, 15 Dec 2021 07:44:54 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 15 Dec 2021 07:44:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=jRwkmLpd9Nndb j3mEezhof84G2aO5vv8/Opou90CXXQ=; b=QdENVoAao1JyVGOPMTVKHi/gUaZ4W scrmnZT9TB/hYoJr6tOKKboWjT9XEZoWl5bsD01xQe4e5aZLVGT8HWXNzM0mnXNm Ks1LEORO2Dkuxl/eqe7useE+2r2xFUp5EKInUYv2Gd2rYUSoaWlb6maGDDjf6cvz h2fiBLpHY39CgeDyL5Q9Mrn10wstR4a9B6YMZoiQ/7474fXGPszFn5n6b3k1od0R cyOcy9fDvky5SV1H9vUoJmFP47tiWQ2mVQWT/OnXMP1+eA+fgqPiT+Y2RvqnYa09 CGyR184CtWckOhhJX4/DFec14tcVyA3DLn/LGAjAvaGA0bZ79wOj+kjTQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=jRwkmLpd9Nndbj3mEezhof84G2aO5vv8/Opou90CXXQ=; b=StElBWJt eyBQ86VimtKUcYTleIFBayrZ2SPtyhyJCqGY5Frp8WBIxYnhbCN1+CMPWUPmSuqS I1BcYB9nnSClY9A1YV8YtI3QgI359aCMRbxfQ7ObGHbRW9ZVvfciNT8+K/N15kky wpHQbVLhuTE9z7hiiNEoOUyznTI2pEYCsvHNsTTINxBA3KcTKJMXaKcCvP5oYAzj MpILcabOMuNoy9wUtk4RgjxW+ksxFbP/wg6m2ase2yNZtCdgHPLpdX12TAQ7TgiI 7DJ8vO5X8tBGrCzLwT+L23jAZhKp20RXJuk1WoFbodpXxR0hJyrv3Q9dclo7hJui p+knYaMY/sCOQg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrledvgdeghecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 15 Dec 2021 07:44:53 -0500 (EST) From: Maxime Ripard To: Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard , Daniel Vetter , David Airlie Subject: [PATCH v2 11/14] drm/vc4: hdmi: Take the sink maximum TMDS clock into account Date: Wed, 15 Dec 2021 13:44:03 +0100 Message-Id: <20211215124406.340180-12-maxime@cerno.tech> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211215124406.340180-1-maxime@cerno.tech> References: <20211215124406.340180-1-maxime@cerno.tech> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Tim Gover , Dave Stevenson , dri-devel@lists.freedesktop.org, Werner Sembach , Phil Elwell Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In the function that validates that the clock isn't too high, we've only taken our controller limitations into account so far. However, the sink can have a limit on the maximum TMDS clock it can deal with too which is exposed through the EDID and the drm_display_info. Make sure we check it. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_hdmi.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 02a5d5a8847e..effc2d42e320 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -1266,12 +1266,18 @@ static enum drm_mode_status vc4_hdmi_encoder_clock_valid(const struct vc4_hdmi *vc4_hdmi, unsigned long long clock) { + const struct drm_connector *connector = &vc4_hdmi->connector; + const struct drm_display_info *info = &connector->display_info; + if (clock > vc4_hdmi->variant->max_pixel_clock) return MODE_CLOCK_HIGH; if (vc4_hdmi->disable_4kp60 && clock > HDMI_14_MAX_TMDS_CLK) return MODE_CLOCK_HIGH; + if (clock > (info->max_tmds_clock * 1000)) + return MODE_CLOCK_HIGH; + return MODE_OK; } -- 2.33.1