From patchwork Sat Jun 1 13:12:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 13682410 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 3D67EC25B7E for ; Sat, 1 Jun 2024 13:13:43 +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=R/GFPTTLvDgbrOQqZwsF0JYpyy8/BXjbt2t8RPzETlA=; b=YDj2LjzEXgNRBi eL9rp+BNVUmu1DRq2/5rR8SdQgEGIUbwuPbZ6pMvzm1molDgK4Ol7Q/Lm7kD+XWA3lLgBDBe3emoe YiUeFjoPqfMOKIG/jcdQRomyBAw9GE5DslfbMQB2gZdL/YaMg5LYv0nbiKjgpjwdDEApqLKPisHce A/abBpeuGmWJENEfv93AQYLsbktaMMaSdGKjitebMPqS26ye3mMQhXNveoY1/WT2ywA9i2kbg421L FyEyAF2WxVZviYlmZyuvXNaUsFdnqcBjVavXJDjFtPOjLQJo6BpsC1kIWT65NByYLVLBfKUV12aDR 3uQ6YWqjATv5iMMwc1/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sDOY8-0000000CeWc-2Dm4; Sat, 01 Jun 2024 13:13:32 +0000 Received: from madrid.collaboradmins.com ([46.235.227.194]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sDOXj-0000000Ce9E-3sF4; Sat, 01 Jun 2024 13:13:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1717247584; bh=wdTfL3nRIT/i+BGqWfrDyHK4xJeuD/9ukGuYk+DmWew=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=m6CKoWUXxqep7cMzq8BiuH4GBKCkAcKYFtsJnatfngYUx1pOTHpmi3Uj+EvCKdnFM VLqRBcCSiGT3NC4mx6FbdbysQ1hs8VmLSUVaWI8uSIJyLB+4fhxfL5vOXKMeXVtKR1 D9qhllMmBdlfRoiBpUhjHXTWJln1viwNQosSMj+CkiiSOCttanMgqdDF8MN+WfdBsd 12I+YJZykeGgtUzc8bLkVaqyLoHTH8ZSI8xCf/rSD7Mo8VgLgt6CXjnjg4BCDLj0ST ImUSsLk/bea73FOSS6Z5hmfy2gYRExXAUJuDqK1tzfvGRjVpxx2vmhx6EOgni2F/+/ TNy1dzihq1B/w== Received: from localhost (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 6745D37821EE; Sat, 1 Jun 2024 13:13:04 +0000 (UTC) From: Cristian Ciocaltea Date: Sat, 01 Jun 2024 16:12:27 +0300 Subject: [PATCH 05/14] drm/bridge: dw-hdmi: Factor out vmode setup MIME-Version: 1.0 Message-Id: <20240601-b4-rk3588-bridge-upstream-v1-5-f6203753232b@collabora.com> References: <20240601-b4-rk3588-bridge-upstream-v1-0-f6203753232b@collabora.com> In-Reply-To: <20240601-b4-rk3588-bridge-upstream-v1-0-f6203753232b@collabora.com> To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Mark Yao Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, kernel@collabora.com, Alexandre ARNOUD , Luis de Arquer X-Mailer: b4 0.14-dev-f7c49 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240601_061308_277571_F9B015A0 X-CRM114-Status: GOOD ( 11.54 ) 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 preparation to add support for the HDMI 2.1 Quad-Pixel TX Controller and minimize code duplication, factor out the vmode setup from hdmi_av_composer() into a common dw_hdmi_prep_vmode() helper. Signed-off-by: Cristian Ciocaltea --- drivers/gpu/drm/bridge/synopsys/dw-hdmi-common.h | 2 ++ drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 23 ++++++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-common.h b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-common.h index 0569196bbe3b..e73b8eb7528b 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-common.h +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-common.h @@ -154,6 +154,8 @@ void dw_hdmi_prep_avi_infoframe(struct hdmi_avi_infoframe *frame, struct dw_hdmi *hdmi, const struct drm_connector *connector, const struct drm_display_mode *mode); +struct hdmi_vmode *dw_hdmi_prep_vmode(struct dw_hdmi *hdmi, + const struct drm_display_mode *mode); enum drm_connector_status dw_hdmi_connector_detect(struct drm_connector *connector, bool force); diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 81d73fbcb2e6..5cf929f68ae9 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -1864,15 +1864,10 @@ static void hdmi_config_drm_infoframe(struct dw_hdmi *hdmi, HDMI_FC_PACKET_TX_EN_DRM_MASK, HDMI_FC_PACKET_TX_EN); } -static void hdmi_av_composer(struct dw_hdmi *hdmi, - const struct drm_display_info *display, - const struct drm_display_mode *mode) +struct hdmi_vmode *dw_hdmi_prep_vmode(struct dw_hdmi *hdmi, + const struct drm_display_mode *mode) { - u8 inv_val, bytes; - const struct drm_hdmi_info *hdmi_info = &display->hdmi; struct hdmi_vmode *vmode = &hdmi->hdmi_data.video_mode; - int hblank, vblank, h_de_hs, v_de_vs, hsync_len, vsync_len; - unsigned int vdisplay, hdisplay; vmode->mpixelclock = mode->clock * 1000; @@ -1900,6 +1895,20 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi, dev_dbg(hdmi->dev, "final tmdsclock = %d\n", vmode->mtmdsclock); + return vmode; +} +EXPORT_SYMBOL_GPL(dw_hdmi_prep_vmode); + +static void hdmi_av_composer(struct dw_hdmi *hdmi, + const struct drm_display_info *display, + const struct drm_display_mode *mode) +{ + u8 inv_val, bytes; + const struct drm_hdmi_info *hdmi_info = &display->hdmi; + struct hdmi_vmode *vmode = dw_hdmi_prep_vmode(hdmi, mode); + int hblank, vblank, h_de_hs, v_de_vs, hsync_len, vsync_len; + unsigned int vdisplay, hdisplay; + /* Set up HDMI_FC_INVIDCONF */ inv_val = (hdmi->hdmi_data.hdcp_enable || (dw_hdmi_support_scdc(hdmi, display) &&