From patchwork Thu Jan 13 14:07:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12712801 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 A6101C433EF for ; Thu, 13 Jan 2022 14:08:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AD0F310E539; Thu, 13 Jan 2022 14:07:59 +0000 (UTC) Received: from new4-smtp.messagingengine.com (new4-smtp.messagingengine.com [66.111.4.230]) by gabe.freedesktop.org (Postfix) with ESMTPS id E5D8810E515 for ; Thu, 13 Jan 2022 14:07:53 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 50550580805; Thu, 13 Jan 2022 09:07:53 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 13 Jan 2022 09:07:53 -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=ttOetNNmfDd++ 1lwywZJq9OWR8IjXZXM4ndiGo8q5xM=; b=auGRLaf+Fq5SnRVKQzJK5jY/AU+e9 pvKPggkdGA415s9GaFCoS+hARe0rMI6KQ11a5Hz6MLSgtetB4uH/pPlAu2TERu9v 1gt+wa70dAVeGV5tER9GzQiWe4jVhG4uKzW/bDIWGAE5Wi59U11aR29RbrrlXuYa 4W+ySCQZV81bUMYwMqaPmfaUgeTbFjUfq2QDhzI1DyZtzjr8JjLGXKPp0CAlW3mr 2V0VqRTL6vRXg01FYhBElAa9X0qeYuFdSI4fD26w+V+qQbbm8Ky/3/+j/pNJd1z8 UO+EixA8kkYNpFw+ooBZzn9XtBFAfRwqujMmktJ6EZf9ZIvcDv9UFU8xQ== 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=ttOetNNmfDd++1lwywZJq9OWR8IjXZXM4ndiGo8q5xM=; b=O8+izWhw UL/frQX47cHDS4ki9gDQshPCE3arUIkD40Ta5/beJ5TwUODv7m8o1bAYerwXUyr5 YSkP+RKPREQSA/NTDSDvofRSzphbV/bSxdelYcJKkZLwcf8Rex8lHIkDnnFGuyz5 e1H9Mns0BuSLqmfBVej+EBvkSyBMHbNgBw23+vXTEemxCDoauCS+YU2etkRptG7z VTnp6eEk/Z7tL/1wLkkePaabgpW1FJio7QCoxeMtWuPPcSYYCu4oypmO10GalkGf 0xwoKgMaewYoaeAbwab+TUGLvwNjHCADk605//vBbkjQeRAsCd7NhX4yqjypOER8 OK0OmE4+UirBYg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrtdefgdehlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 13 Jan 2022 09:07:52 -0500 (EST) From: Maxime Ripard To: Daniel Vetter , David Airlie , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard Subject: [PATCH v3 13/16] drm/vc4: hdmi: Take the sink maximum TMDS clock into account Date: Thu, 13 Jan 2022 15:07:17 +0100 Message-Id: <20220113140720.1678907-14-maxime@cerno.tech> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220113140720.1678907-1-maxime@cerno.tech> References: <20220113140720.1678907-1-maxime@cerno.tech> MIME-Version: 1.0 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 , Werner Sembach , dri-devel@lists.freedesktop.org, 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 764f3c5cfa54..b68d3626d1a3 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 (info->max_tmds_clock && clock > (info->max_tmds_clock * 1000)) + return MODE_CLOCK_HIGH; + return MODE_OK; }