Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2166649lqb; Mon, 27 May 2024 09:52:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW0qWi0A9aqEkT6bPQEc/vv7mnkwpkviRIFY3SpQ402rPA5Aarshm1upj77ptD9h+N6tDvIiMLTS6O/d4AhDbJAtCfrEWbQHwIjwh6Yng== X-Google-Smtp-Source: AGHT+IFNUL3TM5VIZdBEWyJmDyXo2p0PCVsZufjF05IW/jw1DNKE+3NXo/VSsC7EjP5IZ8dQxsUp X-Received: by 2002:a05:6a20:430e:b0:1af:d1f0:b34e with SMTP id adf61e73a8af0-1b212d38fbemr12187962637.7.1716828733894; Mon, 27 May 2024 09:52:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716828733; cv=pass; d=google.com; s=arc-20160816; b=MTitGA+YZ/XuQEy5OBbIjS8BuxoQ2gtdMIE3d79gsQBdbtR34AG1qO77lzOIfzjI+k AQSd5gIkR1APOsLIbdoHnZtqxWk33EOJ/TpWMkIo/2ETtQcGmL8D7Hey0FNv01/PzaSd c4luEBk5ZCz2QungHL145QRep/S8xInbfIQbfPnmXBYjCso+q5KcHtaiTu7EZjvcIlgS TJQ3cUTdy8z3oVDb8GUzAvLAIsz7bJdDy3OTff8f7c0FeyEU0yg2h5Ln6RvPqb1i+eW9 VOpgr6/zP7/jEoF7kSUtsKsiA5gAoDNeYVFB6ntPSceIiFlH+qmPE2kLVtvy2yExPyCK 81OA== 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=YiBx3Szo6any/+EHUVxoqeC/JqjdjgFnJkGZYhVI19Q=; fh=6NizDipd09vQJwyUwM008+xm9H4sCELmu0of8ekN+Wk=; b=yoHsYxSMom0/16hIrBQI6xWRhuK9zOitBAWucogjSagLXM2ohaQJZsokGo7JuEPkc4 3gIsSa2ZMHEPLaKvn+ylCsrFdC5oheOiB/REhKjgZkFgiTY91tbPh+NMNtsXWRmWdkz4 vuU5hqwrenxRc1kzH7W+ZGKCwsiWz/hr5izwvRGX1ogvaJkCz+qlf/0kwFB6xzlJnwMn jaR6SFP8vgveBeA83qC9qefPnlJLeWs1Dy08rRuJrMsE1MtThu1RrCTRceK3lfTfwEpo YwhjcZcV+tzW5BRPfwqZCtEjarOpGcuCX/59nZrJYTP2uJFW5DuZ41nDCkwRtvq3IO+E Hxpw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GV9MYTmT; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-190765-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190765-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f8fc372b58si6454231b3a.137.2024.05.27.09.52.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 09:52:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-190765-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GV9MYTmT; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-190765-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190765-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id DB37429451D for ; Mon, 27 May 2024 13:59:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2745515EFB3; Mon, 27 May 2024 13:58:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GV9MYTmT" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1829015FA61; Mon, 27 May 2024 13:58:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716818297; cv=none; b=K48aH7SF1FZZa4/20Oi/Faf8NkZmYuc6Q4reGPDbPzj483LpZLQTRHcb9n/cIrZZYX93sSt89NpdTERfvFiG3SQDuBIw3zBlnQ9uPABiewSiDrsPkFwIkXrubZ3lWIYw5BxlDGmThNb1wgbQeISYIotkwCg7dpbUm+EqeMVwsZw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716818297; c=relaxed/simple; bh=yFSA4w+ARQ3QxiRHadSdscbu33xQm71NKpYfvHru96g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=F1hH+XeEWp2dAwN8ET5ngdw+5kDbVqHPDbhAPNZ69iB//38yRGwFD57qvcDlByFce21dV4Xon1t236Q093yf8wZIfLMDrE7VjGyryPMSjUUEcAKnbBUctwPrTOTTX6Db6nsBFmddfTgRPqwKKKyXVuZtuyHWOCXPHExl/2LMPU0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GV9MYTmT; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7067FC4AF09; Mon, 27 May 2024 13:58:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716818297; bh=yFSA4w+ARQ3QxiRHadSdscbu33xQm71NKpYfvHru96g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=GV9MYTmTwngBdCcXfzHETJ8Wbcgt3aKov2LNZ2uH4lGVYolSIKHUTUQn0/lBfz43G lA6l74M2PsSMkeO2vAQiaoSQANNEOe1EKSIDLPIn//dlg1TMr2o+pDfrgeGHvofvUw RiEtLljY52Gxd+YrG06WUK8A+IxkckEFW9+3D3QjOS7fN6AmyQFh1ANWM1Cmu+BYpv L+dASaKGiEHxMvOAl9ev7uiF1VN5fCIiNrOP+DY18AgI/GUB7bVCny9VlGfcF95Xau Vt2Vgqzgu2NdN41JQ9Vf/Fr4AxCp2iC0Hr/AG849jX1idgixX+xlLtZB9TvlK4KDhz fdTwjDAa2Q1WA== From: Maxime Ripard Date: Mon, 27 May 2024 15:57:52 +0200 Subject: [PATCH v15 03/29] drm/connector: hdmi: Create an HDMI sub-state 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: <20240527-kms-hdmi-connector-state-v15-3-c5af16c3aae2@kernel.org> References: <20240527-kms-hdmi-connector-state-v15-0-c5af16c3aae2@kernel.org> In-Reply-To: <20240527-kms-hdmi-connector-state-v15-0-c5af16c3aae2@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Jonathan Corbet , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Andy Yan Cc: Hans Verkuil , Sebastian Wick , =?utf-8?q?Ville_Syrj=C3=A4l=C3=A4?= , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-sunxi@lists.linux.dev, Maxime Ripard , Dave Stevenson , Sui Jingfeng , Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5237; i=mripard@kernel.org; h=from:subject:message-id; bh=yFSA4w+ARQ3QxiRHadSdscbu33xQm71NKpYfvHru96g=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDGkhExOjrrW5br3RsM4p4k9SbEVKxC/fplOGBpfFCtJXb T1ZzcvQMZWFQZiTQVZMkeWJTNjp5e2LqxzsV/6AmcPKBDKEgYtTACYS/oixYev59ic1Gt3HT9+9 ukK0bffZML9DXPlFPMsY2a5ceypmnP3f7ICu+0uBpU7GSe/TrvxpZ6wz/XVn82cDKVenGTwqcn4 Bz8K4qu7Jssi8k774+tHppbrJzfcEV610jOqJ5Fh0aP/kBaYA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D The next features we will need to share across drivers will need to store some parameters for drivers to use, such as the selected output format. Let's create a new connector sub-state dedicated to HDMI controllers, that will eventually store everything we need. Reviewed-by: Dave Stevenson Reviewed-by: Sui Jingfeng Reviewed-by: Dmitry Baryshkov Signed-off-by: Maxime Ripard --- drivers/gpu/drm/display/Kconfig | 7 +++++ drivers/gpu/drm/display/Makefile | 2 ++ drivers/gpu/drm/display/drm_hdmi_state_helper.c | 41 +++++++++++++++++++++++++ include/drm/display/drm_hdmi_state_helper.h | 16 ++++++++++ include/drm/drm_connector.h | 7 +++++ 5 files changed, 73 insertions(+) diff --git a/drivers/gpu/drm/display/Kconfig b/drivers/gpu/drm/display/Kconfig index 864a6488bfdf..14114b597ef4 100644 --- a/drivers/gpu/drm/display/Kconfig +++ b/drivers/gpu/drm/display/Kconfig @@ -68,5 +68,12 @@ config DRM_DISPLAY_HDCP_HELPER config DRM_DISPLAY_HDMI_HELPER bool depends on DRM_DISPLAY_HELPER help DRM display helpers for HDMI. + +config DRM_DISPLAY_HDMI_STATE_HELPER + bool + depends on DRM_DISPLAY_HELPER + depends on DRM_DISPLAY_HDMI_HELPER + help + DRM KMS state helpers for HDMI. diff --git a/drivers/gpu/drm/display/Makefile b/drivers/gpu/drm/display/Makefile index 17d2cc73ff56..629df2f4d322 100644 --- a/drivers/gpu/drm/display/Makefile +++ b/drivers/gpu/drm/display/Makefile @@ -12,9 +12,11 @@ drm_display_helper-$(CONFIG_DRM_DISPLAY_DP_TUNNEL) += \ drm_dp_tunnel.o drm_display_helper-$(CONFIG_DRM_DISPLAY_HDCP_HELPER) += drm_hdcp_helper.o drm_display_helper-$(CONFIG_DRM_DISPLAY_HDMI_HELPER) += \ drm_hdmi_helper.o \ drm_scdc_helper.o +drm_display_helper-$(CONFIG_DRM_DISPLAY_HDMI_STATE_HELPER) += \ + drm_hdmi_state_helper.o drm_display_helper-$(CONFIG_DRM_DISPLAY_DP_AUX_CHARDEV) += drm_dp_aux_dev.o drm_display_helper-$(CONFIG_DRM_DISPLAY_DP_AUX_CEC) += drm_dp_cec.o obj-$(CONFIG_DRM_DISPLAY_HELPER) += drm_display_helper.o diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c new file mode 100644 index 000000000000..1e92c1108d23 --- /dev/null +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: MIT + +#include +#include + +#include + +/** + * __drm_atomic_helper_connector_hdmi_reset() - Initializes all HDMI @drm_connector_state resources + * @connector: DRM connector + * @new_conn_state: connector state to reset + * + * Initializes all HDMI resources from a @drm_connector_state without + * actually allocating it. This is useful for HDMI drivers, in + * combination with __drm_atomic_helper_connector_reset() or + * drm_atomic_helper_connector_reset(). + */ +void __drm_atomic_helper_connector_hdmi_reset(struct drm_connector *connector, + struct drm_connector_state *new_conn_state) +{ +} +EXPORT_SYMBOL(__drm_atomic_helper_connector_hdmi_reset); + +/** + * drm_atomic_helper_connector_hdmi_check() - Helper to check HDMI connector atomic state + * @connector: DRM Connector + * @state: the DRM State object + * + * Provides a default connector state check handler for HDMI connectors. + * Checks that a desired connector update is valid, and updates various + * fields of derived state. + * + * RETURNS: + * Zero on success, or an errno code otherwise. + */ +int drm_atomic_helper_connector_hdmi_check(struct drm_connector *connector, + struct drm_atomic_state *state) +{ + return 0; +} +EXPORT_SYMBOL(drm_atomic_helper_connector_hdmi_check); diff --git a/include/drm/display/drm_hdmi_state_helper.h b/include/drm/display/drm_hdmi_state_helper.h new file mode 100644 index 000000000000..6021983e2602 --- /dev/null +++ b/include/drm/display/drm_hdmi_state_helper.h @@ -0,0 +1,16 @@ +#/* SPDX-License-Identifier: MIT */ + +#ifndef DRM_HDMI_STATE_HELPER_H_ +#define DRM_HDMI_STATE_HELPER_H_ + +struct drm_atomic_state; +struct drm_connector; +struct drm_connector_state; + +void __drm_atomic_helper_connector_hdmi_reset(struct drm_connector *connector, + struct drm_connector_state *new_conn_state); + +int drm_atomic_helper_connector_hdmi_check(struct drm_connector *connector, + struct drm_atomic_state *state); + +#endif // DRM_HDMI_STATE_HELPER_H_ diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 4491c4c2fb6e..000a2a156619 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1029,10 +1029,17 @@ struct drm_connector_state { /** * @hdr_output_metadata: * DRM blob property for HDR output metadata */ struct drm_property_blob *hdr_output_metadata; + + /** + * @hdmi: HDMI-related variable and properties. Filled by + * @drm_atomic_helper_connector_hdmi_check(). + */ + struct { + } hdmi; }; /** * struct drm_connector_funcs - control connectors on a given device * -- 2.45.0