Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp11305lqj; Sat, 1 Jun 2024 06:14:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXGwh2Fj3vet/ngnNznuM4HtWkFOtzfL66sX3MIhxMJfb64hUI/lW6I74MPSPkADHJ4fBxZzFk6EfoeT+rJ/DSZLtnAieyME/UY4is+qQ== X-Google-Smtp-Source: AGHT+IFQsd3K4gfjzNEyWVpp5i03xf0tJa5gmSge10pQPYE98vqnTNule+sfZE/wcWSbhC/ayIW5 X-Received: by 2002:a0c:eb08:0:b0:6af:351b:bb0e with SMTP id 6a1803df08f44-6af351bbdc3mr18495806d6.14.1717247671827; Sat, 01 Jun 2024 06:14:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717247671; cv=pass; d=google.com; s=arc-20160816; b=F9dpQn99PXdsI3r3TRvdNtUV8atYwVCbspf0d8kFFn7SAX/YAVcUbiHeYmzc5Qj7Yd t5K83qhG72dvHhYaHs/1R6Te715KUEYQHIqP9JC/Ws9iktirc9RCnN9/LYbp6DKohLdX H1bDqHzGRHMdxhx9JcKBMuBHAVbkf1oHh6y02FANjhOTGvvbf4/2YE4wHfh2GMnidsHX dipca6KgwRwJmwaNrzUmutpFsYVPT8FEuis0UcFpSTSFzotPZmi+yIELiYH3gz3I92G+ 4ILpjkUPbgnuVeQEthF5cBa2KBRRR7UyuIl2x2hBiLerc/OfRCBPkEyeaVptHeVTJf7K i0/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=lhqb0Q3geFBmN+ec+NXsFn+iyTTvN3bMiF0ZLGbjpGE=; fh=lwnmantY1w9Tee5UVCW0JNSzjw2yECTYhtHjua6upNg=; b=Ycw2N08DDCVWryTpc0kFarZW8XykQMfzE+s8AoSx7Eas1haVPxHDNvrpJ7NIn/U8YC s8KmYTDIOxtookUEtCOjrA4Oq280KijsF87EWoPevloLfRVXiieWB8GvfvOzrWLiZ9Gc L9sNtghc5c43C87g2XdUqMMCcXbIf4A4Njd7r81sB0tOx9xH5IhQjiDos/5iBBC78ndh gimz1AS3PlIalOwzJ6LdCi2ZHlVrJpoctvAujT3JxDIWQhLjKcuccyBzTkQMYu4qr0wd PH1z1mflAL+gqvXeM8X67MahykRUTsG8C/1QME1kEK+L19Pl/710OmTNrOwq8yRYHHGh gXhg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=m6CKoWUX; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-197854-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197854-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6ae4a741f4bsi43673126d6.134.2024.06.01.06.14.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Jun 2024 06:14:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-197854-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=m6CKoWUX; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-197854-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197854-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 840E41C2133E for ; Sat, 1 Jun 2024 13:14:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 33D67152E1C; Sat, 1 Jun 2024 13:13:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="m6CKoWUX" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A93CE15216C; Sat, 1 Jun 2024 13:13:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717247592; cv=none; b=ERGYcBPE60gaTWj83nLggkxw/Ob2SXJPNZbIKfbCC4+NvdEp6XBor9yR7Ntyk8kSEVF115hKEsYLuQhgmP5bgLA3KKLLhpc9pgksK2W79b82HbPj1/Snm3FOvU7TJ4dV4ptcXHiTmWnZLLlYFGZY61U18rkG2d3W2xTYkbxxQKI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717247592; c=relaxed/simple; bh=wdTfL3nRIT/i+BGqWfrDyHK4xJeuD/9ukGuYk+DmWew=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nebsS6elU4cQtnMgX54V/KxZsMmAmeSZjg0NzVsDGhSE2Ok1mgJbAMpf6pMx+uOXEBxCGOC5lZDsnMT/UbNZT5mHHgSOWi4ymMP0C5+c/zubmyiTGyk0eh5csOvifqc+8Dno96jmzpH7qKaJvaaqCYH7CakizMnQ5rqlidii+60= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=m6CKoWUX; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 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) && -- 2.45.0