Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp11219lqj; Sat, 1 Jun 2024 06:14:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVfH6AzCtIiDTwBpmtOQcG99VlGwBTfaDxwUeqKEVZvz9JVGYkmFbeM7FnU/XuNIOuDLrXdw08gPDTvegBxH2QxdD8jpIMDh3OZl8287w== X-Google-Smtp-Source: AGHT+IHGMWMtn+3bctn1clF+HDmxg07H5yeyFVS+8Z1rfqjTueZrMAJhfL1hlIPWWovHWMswCf0E X-Received: by 2002:a50:9e61:0:b0:579:f196:487f with SMTP id 4fb4d7f45d1cf-57a363ffbf2mr4176448a12.31.1717247661391; Sat, 01 Jun 2024 06:14:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717247661; cv=pass; d=google.com; s=arc-20160816; b=b82MF/UsgaArz3pJSOF1BDCaPJRq6E67tj6k1YSOUqo2Wg04N6YqGb89nLnnjEmo6N jHGypYFH3Ig5R5TqcWStFW3+PdresfGznNyZDLusykXLzHmOPfWSVa34vNCqJWz7JePS Pt40105/375JodRUjjtc8dg5jg+FlqcuJL4v9bQZDTnrz3zoRGURwwGTH9Xh0EZHt8Ki ZFi70etyO+RTmVUPv7uxfY9oveK+adMMimtItyWZUgqMqPTM6UwVwRvErQThHE/7uSsa xDqHawjzYRQNRut8Z9F668G33P07eNBwtx4J075y+onFf6gcQN6XiMZA1o8GnwMEt0Op 2DZg== 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=2z0xRQU6NWWWBfRFzHQpRlDtNpJF9hUc4MyPuGdFeW4=; fh=lwnmantY1w9Tee5UVCW0JNSzjw2yECTYhtHjua6upNg=; b=Ki2/iiQ1vNfTR5oIjQt9reRl6vZtG094k6Rub7XWuInGIgYNh4xvq2yY787X2bPpqL ZJQoA97dwuVAzKnT23dXNU8tyXo007Y6rRwG6Ohrmfs/DmtJuD10y0U91S/j3+nDe1EU EYu/JCWg6Qt+zJVbBYVHExH+6Cul46FlhsFd9NBc9L9uZgzCXTofIiQp7wEZ7MRI+dIq Zi1WyMuzvZ4YgqDQbuyWEYSVEgbsDJYCj7y9LcY//s6lqZDw7RWaN5nJUGd2/zV1CIDP 5urYhh/c0xqnFS3RVBOVc95nTMJPQq3wiaPxeMDWRW3daycOkZihEWsSL4My1en2U9gf qglA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=vxS8ToKO; 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-197853-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197853-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31b80ebfsi2075413a12.96.2024.06.01.06.14.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Jun 2024 06:14:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-197853-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=vxS8ToKO; 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-197853-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197853-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 am.mirrors.kernel.org (Postfix) with ESMTPS id EB25D1F217C2 for ; Sat, 1 Jun 2024 13:14:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B3D9A1527BF; Sat, 1 Jun 2024 13:13:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="vxS8ToKO" 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 190F21514F4; 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=1717247591; cv=none; b=XgVE9273pNjnhBhBArR4J1qtiB1AsHOkPWpxaI78TyblNutuBfs7OqkFgTl8QIhVw8rSMTj+82ShX3tAT+ryReUPi33Xh0AyQdTebW5KXCIaT7oh8z/NSwPtpsmTR6T8uq+7/cw1wrc/PVS4N+NrhCeiZeQ1T+W2lUo1s3TIwvk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717247591; c=relaxed/simple; bh=8uRhqLiAdkGIlh3VTlM1cQofy1gF9s+TKt0ENoIYejs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Qf8SVN67gG+W7V2JGF2ZH7xpuMNxnKi6Ch8fIDLEC0YTYUHUgI05ZMdlePGz+nzrWIEMn7SlsCGc4KCxTIK5uQqXCuYF8UFDr2f30aXVvXFlb+E6nCqR9lKYpUCkxDG6FMhnWz6UM/8R2uOa3rl7+BoNRLnZtWRtKatXLTGb0bU= 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=vxS8ToKO; 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=1717247583; bh=8uRhqLiAdkGIlh3VTlM1cQofy1gF9s+TKt0ENoIYejs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=vxS8ToKOD9x3MfJOagpxmnjgKb8QkJVEMjq8Yp1mb9bT9G4vI3KqyMYSI+RgexhR0 8hcEbfOui1Vw7mVe2TyqPTmaNYv/IIqpz2xojZi43z0JFPqDps+UkVzI1mXyXSSiJH mL02UnET/FOs/KM4964Go8HIaFMApo6OHaleu3WZUDS0JGYHdmUwxs91i3rLmmXg7p RGyy9gCMJ3n8CeQaaeyiqi1sbSa8DSl4RFcNgb9xxzNx9XxHNuydG4zIFyCwSDcSRY Acu1l0Pn839x+gELe/eqLGbnmKRVyxw92PlnfJpT7PluyB+nRO/hGsCjrrhRwOX0DM uj2zZB4GVzJIw== 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 3039437821EB; Sat, 1 Jun 2024 13:13:03 +0000 (UTC) From: Cristian Ciocaltea Date: Sat, 01 Jun 2024 16:12:26 +0300 Subject: [PATCH 04/14] drm/bridge: dw-hdmi: Factor out AVI infoframe 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-4-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 AVI infoframe setup from hdmi_config_AVI() into a common dw_hdmi_prep_avi_infoframe() helper. Signed-off-by: Cristian Ciocaltea --- drivers/gpu/drm/bridge/synopsys/dw-hdmi-common.h | 4 ++ drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 57 ++++++++++++++---------- 2 files changed, 37 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-common.h b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-common.h index ffd2ee16466c..0569196bbe3b 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-common.h +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-common.h @@ -150,6 +150,10 @@ struct i2c_adapter *dw_hdmi_i2c_adapter(struct dw_hdmi *hdmi, const struct i2c_algorithm *algo); bool dw_hdmi_support_scdc(struct dw_hdmi *hdmi, const struct drm_display_info *display); +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); 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 5dd0e2bc080d..81d73fbcb2e6 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -1638,66 +1638,75 @@ static void hdmi_tx_hdcp_config(struct dw_hdmi *hdmi) HDMI_A_HDCPCFG1_ENCRYPTIONDISABLE_MASK, HDMI_A_HDCPCFG1); } -static void hdmi_config_AVI(struct dw_hdmi *hdmi, - const struct drm_connector *connector, - const struct drm_display_mode *mode) +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_avi_infoframe frame; - u8 val; - /* Initialise info frame from DRM mode */ - drm_hdmi_avi_infoframe_from_display_mode(&frame, connector, mode); + drm_hdmi_avi_infoframe_from_display_mode(frame, connector, mode); if (hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format)) { - drm_hdmi_avi_infoframe_quant_range(&frame, connector, mode, + drm_hdmi_avi_infoframe_quant_range(frame, connector, mode, hdmi->hdmi_data.rgb_limited_range ? HDMI_QUANTIZATION_RANGE_LIMITED : HDMI_QUANTIZATION_RANGE_FULL); } else { - frame.quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT; - frame.ycc_quantization_range = + frame->quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT; + frame->ycc_quantization_range = HDMI_YCC_QUANTIZATION_RANGE_LIMITED; } if (hdmi_bus_fmt_is_yuv444(hdmi->hdmi_data.enc_out_bus_format)) - frame.colorspace = HDMI_COLORSPACE_YUV444; + frame->colorspace = HDMI_COLORSPACE_YUV444; else if (hdmi_bus_fmt_is_yuv422(hdmi->hdmi_data.enc_out_bus_format)) - frame.colorspace = HDMI_COLORSPACE_YUV422; + frame->colorspace = HDMI_COLORSPACE_YUV422; else if (hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format)) - frame.colorspace = HDMI_COLORSPACE_YUV420; + frame->colorspace = HDMI_COLORSPACE_YUV420; else - frame.colorspace = HDMI_COLORSPACE_RGB; + frame->colorspace = HDMI_COLORSPACE_RGB; /* Set up colorimetry */ if (!hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format)) { switch (hdmi->hdmi_data.enc_out_encoding) { case V4L2_YCBCR_ENC_601: if (hdmi->hdmi_data.enc_in_encoding == V4L2_YCBCR_ENC_XV601) - frame.colorimetry = HDMI_COLORIMETRY_EXTENDED; + frame->colorimetry = HDMI_COLORIMETRY_EXTENDED; else - frame.colorimetry = HDMI_COLORIMETRY_ITU_601; - frame.extended_colorimetry = + frame->colorimetry = HDMI_COLORIMETRY_ITU_601; + frame->extended_colorimetry = HDMI_EXTENDED_COLORIMETRY_XV_YCC_601; break; case V4L2_YCBCR_ENC_709: if (hdmi->hdmi_data.enc_in_encoding == V4L2_YCBCR_ENC_XV709) - frame.colorimetry = HDMI_COLORIMETRY_EXTENDED; + frame->colorimetry = HDMI_COLORIMETRY_EXTENDED; else - frame.colorimetry = HDMI_COLORIMETRY_ITU_709; - frame.extended_colorimetry = + frame->colorimetry = HDMI_COLORIMETRY_ITU_709; + frame->extended_colorimetry = HDMI_EXTENDED_COLORIMETRY_XV_YCC_709; break; default: /* Carries no data */ - frame.colorimetry = HDMI_COLORIMETRY_ITU_601; - frame.extended_colorimetry = + frame->colorimetry = HDMI_COLORIMETRY_ITU_601; + frame->extended_colorimetry = HDMI_EXTENDED_COLORIMETRY_XV_YCC_601; break; } } else { - frame.colorimetry = HDMI_COLORIMETRY_NONE; - frame.extended_colorimetry = + frame->colorimetry = HDMI_COLORIMETRY_NONE; + frame->extended_colorimetry = HDMI_EXTENDED_COLORIMETRY_XV_YCC_601; } +} +EXPORT_SYMBOL_GPL(dw_hdmi_prep_avi_infoframe); + +static void hdmi_config_AVI(struct dw_hdmi *hdmi, + const struct drm_connector *connector, + const struct drm_display_mode *mode) +{ + struct hdmi_avi_infoframe frame; + u8 val; + + dw_hdmi_prep_avi_infoframe(&frame, hdmi, connector, mode); /* * The Designware IP uses a different byte format from standard -- 2.45.0