From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F947606A31C for ; Tue, 20 Oct 2026 07:30:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Dwr+QmYm; dkim=fail reason="signature verification failed" (1024-bit key, unprotected) header.d=airkyi.com header.i=@airkyi.com header.a=rsa-sha256 header.s=altu2504 header.b=jnTTEaZZ 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:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JdL9JPJwRNuUbR/qQR22N0qGhr+e1SwL2XTl7Rr0quQ=; b=Dwr+QmYml6Bqwl +zhcJP4HAGvU5EZSfoML7amksOW6CCyz798KsIFvKTGk2IJ5lZrW8PiI4qTU/QLYE38UNf82ZNtru aJsylzaZYNDwaYoD4h5vipbCFvL8fFBwKZwYQxMKdfP/QvFMB5v2uVwV1TMtYQgiph9QuNzGPEnay dvD60/CpRV/6eUwGaisQWe1iEn0c+JWTx6xYWsp2xzZQ+ifVoGxEgNnkpLCusP+cSOpTsaNwcWPba +zaGU0+nyAltMhBN9qSbxLAa8wp0eaPb7uABr+6YojKzpIobUS/j4tQmkNjWLenuZ8uly3vd1Oafo 7kyM/EZ9j4LNf4h3ed4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xJ4IN-000000092FG-3C71; Tue, 20 Oct 2026 07:30:03 +0000 Received: from smtpbguseast3.qq.com ([54.243.244.52]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xJ4IG-0000000923e-3CvX; Tue, 20 Oct 2026 07:30:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=airkyi.com; s=altu2504; t=1792481330; bh=zucQVzSIUw03oJCE6b3rhFHV2mvKBR8XAIBKZOC9G3s=; h=From:To:Subject:Date:Message-Id; b=jnTTEaZZgIfJ04DaD6PtJIG75Y5A6w4kObK/NPlErOXlsS48qqk9SkGcvFXtzjQII z9cu0mY6Tcw/xvjLNxKNSqSzhbXon+wqJnkB03PQFbW33ae618dubqZPZM1oFIpaR2 AUXx9P9mEsg8scujbsxnw2LGytzwvVsieuSZwNEM= X-QQ-mid: zesmtpsz4t1792481329ta1e1f4ab X-QQ-Originating-IP: sJwipE1O7diWFwQRtlG8p3SLGNUGaH/9cyjMchI0jJw= Received: from DESKTOP-8BT1A2O.localdomain ( [61.154.14.86]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 20 Oct 2026 15:28:43 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 10529716609256406642 From: Chaoyi Chen To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Sandy Huang , =?UTF-8?q?Heiko=20St=C3=BCbner?= , Andy Yan , Vinod Koul , Sebastian Reichel , Nicolas Frattaroli , Heikki Krogerus Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-phy@lists.infradead.org, Chaoyi Chen Subject: [PATCH v8 2/7] drm/bridge: Implement generic USB Type-C DP HPD bridge Date: Tue, 20 Oct 2026 15:28:11 +0800 Message-Id: <20261020072816.180-3-kernel@airkyi.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20261020072816.180-1-kernel@airkyi.com> References: <20261020072816.180-1-kernel@airkyi.com> X-QQ-SENDSIZE: 520 Feedback-ID: zesmtpsz:airkyi.com:qybglogicsvrgz:qybglogicsvrgz6b-0 X-QQ-XMAILINFO: M6I+dON63j22UJDh/oIlG+O54AA1vzMtE7elUIkZIhWnguCPtxZI96bZ tixgVQz+8pRLWLLaHM+41RHhLAZ3UShJMWbKGzZ9y6rN3Y0tfD1D8Bo4aC1mCPqBQGJ94vR gJ8bokZykoudwn1UN+GIcTD1vNubtRe2hQQ0KN7Y3aXogteH0XWUtrjsU3WFUDr2L/8EmN+ f25EwP1UpulLDTTpfiXfAr283paP5LHQEtE8Kau9mxsUXP3Dzg+Hg9TomrETN4pqdci9Vj8 62p1Mzg6PR2YSe6by5xb2dmP/m818YaE2bdgkVF48XouIqeFSNsajApFvefz8ecQYl7fAUh fKoXc8x/7lDBPQzccyJ6lqrxieilREWMkzfqikO5Aj5BV5bSu8EoPdAA9n5ZXoP2RJyq83Y XMBeJg7K5Uqpi6rrO61fHALPzBxKKonOYjqPvJiT5mCKfhP1piUmLzZRO7hZMI8Y2v9SjCn wd7TycGMHhFhEQFEHg8639yTm+706le9sK5f0I86Jf9DV6a1mutgNBlkkzQ++wtNKy73NWq ScZJdOB5qNVBivlilB/40UaEqYcbZoU2ID9cGYanF8TxQ0dHBtcDMMxZ5DWrH5ICCUfwi5W S6Q6R1Fv03Nb7aaESiv54IS8I5IPSJzR82Q0c8yKTF1XSZ91hZcPtDfdvdeQJPot2TUIbtl h2hwOsPJyWiTle/4DeHtfZGMw1BAc41h1rJH7rW90jTrV5PITQ82hXZ/rxiqFKJzVlcmzP3 u/ioBln1mVTi6VkvN0zk3XxgW/xvEFpuC7MxHit2MCqM5CfWYSN/kaytSFMLT+h0PU16Syz /xg3uV5Hou9AEnNH+uhAjJD37XZtNaBILJKj5tCO4tQlJTuStQOlyKDsrTbVxdhnAoQbK0w S4UEr8tjndGsu90evv9rp/rUdc5Dl+UIBQasSjFbGcdq899BDzcEBZ2n/AMCujJEt7hBxpm HsTa0ox/HI2tFDyfbesiVEcUqs4LminH0YroP8b7/ReJQ4rGbrZict0aIG9JdwOHMAmD22S ISnbWrVYmutwpZbfm4lgb6tUOjBYUYlIZo58q4lHS9Vc4yLv6q X-QQ-XMRINFO: OWPUhxQsoeAVwkVaQIEGSKwwgKCxK/fD5g== X-QQ-RECHKSPAM: 0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261020_002957_286043_56F13A40 X-CRM114-Status: GOOD ( 20.97 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Archive: List-Post: List-Help: List-Subscribe: , X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-phy" X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 From: Chaoyi Chen The HPD function of Type-C DP is implemented through drm_connector_oob_hotplug_event(). For embedded DP, it is required that the DRM connector fwnode corresponds to the Type-C port fwnode. To describe the relationship between the DP controller and the Type-C port device, we usually using drm_bridge to build a bridge chain. Now several USB-C controller drivers have already implemented the DP HPD bridge function provided by aux-hpd-bridge.c, it will build a DP HPD bridge on USB-C connector port device. But this requires the USB-C controller driver to manually register the HPD bridge. If the driver does not implement this feature, the bridge will not be create. So this patch implements a generic DP HPD bridge based on aux-hpd-bridge.c. It will monitor Type-C bus events, and when a Type-C port device containing the DP svid is registered, it will create an HPD bridge for it without the need for the USB-C controller driver to implement it. Signed-off-by: Chaoyi Chen Reviewed-by: Heikki Krogerus Reviewed-by: Nicolas Frattaroli Reviewed-by: Sebastian Reichel Tested-by: Sebastian Reichel --- (no changes since v7) Changes in v6: - Avoid duplicate registration of the same DisplayPort HPD bridge. (no changes since v5) Changes in v4: - Scan the entire typec_bus and attempt to register the hpd bridge, so as not to miss devices that were already added during initialization. (no changes since v3) Changes in v2: - Add copyright text. - Remove useless goto. --- drivers/gpu/drm/bridge/Kconfig | 10 +++ drivers/gpu/drm/bridge/Makefile | 1 + .../gpu/drm/bridge/aux-hpd-typec-dp-bridge.c | 67 +++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 drivers/gpu/drm/bridge/aux-hpd-typec-dp-bridge.c diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index 4a57d49b4c6d..9739b2a19758 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -30,6 +30,16 @@ config DRM_AUX_HPD_BRIDGE Simple bridge that terminates the bridge chain and provides HPD support. +if DRM_AUX_HPD_BRIDGE +config DRM_AUX_HPD_TYPEC_BRIDGE + tristate + depends on TYPEC || !TYPEC + default TYPEC + help + Simple bridge that terminates the bridge chain and provides HPD + support. It build bridge on each USB-C connector device node. +endif + menu "Display Interface Bridges" depends on DRM && DRM_BRIDGE diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile index 15cc821d85b7..d88a9e1ccc9a 100644 --- a/drivers/gpu/drm/bridge/Makefile +++ b/drivers/gpu/drm/bridge/Makefile @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_DRM_AUX_BRIDGE) += aux-bridge.o obj-$(CONFIG_DRM_AUX_HPD_BRIDGE) += aux-hpd-bridge.o +obj-$(CONFIG_DRM_AUX_HPD_TYPEC_BRIDGE) += aux-hpd-typec-dp-bridge.o obj-$(CONFIG_DRM_CHIPONE_ICN6211) += chipone-icn6211.o obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o obj-$(CONFIG_DRM_CROS_EC_ANX7688) += cros-ec-anx7688.o diff --git a/drivers/gpu/drm/bridge/aux-hpd-typec-dp-bridge.c b/drivers/gpu/drm/bridge/aux-hpd-typec-dp-bridge.c new file mode 100644 index 000000000000..682bc192e093 --- /dev/null +++ b/drivers/gpu/drm/bridge/aux-hpd-typec-dp-bridge.c @@ -0,0 +1,67 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2026 Rockchip Electronics Co., Ltd. + * + * Author: Chaoyi Chen + */ +#include +#include +#include + +#include + +static int drm_typec_bus_event(struct notifier_block *nb, unsigned long action, + void *data) +{ + struct device *dev = (struct device *)data; + struct typec_altmode *alt = to_typec_altmode(dev); + struct device_node *np; + + if (action != BUS_NOTIFY_ADD_DEVICE) + return NOTIFY_OK; + + /* + * alt->dev.parent->parent : USB-C controller device + * alt->dev.parent : USB-C connector device + */ + if (is_typec_port_altmode(&alt->dev) && alt->svid == USB_TYPEC_DP_SID) { + np = to_of_node(alt->dev.parent->fwnode); + if (!drm_dev_has_dp_hpd_bridge(alt->dev.parent->parent, np)) + drm_dp_hpd_bridge_register(alt->dev.parent->parent, np); + } + + return NOTIFY_OK; +} + +static struct notifier_block drm_typec_event_nb = { + .notifier_call = drm_typec_bus_event, +}; + +static int check_device_already_added(struct device *dev, void *data) +{ + drm_typec_bus_event(NULL, BUS_NOTIFY_ADD_DEVICE, dev); + return 0; +} + +static void drm_aux_hpd_typec_dp_bridge_module_exit(void) +{ + bus_unregister_notifier(&typec_bus, &drm_typec_event_nb); +} + +static int __init drm_aux_hpd_typec_dp_bridge_module_init(void) +{ + bus_register_notifier(&typec_bus, &drm_typec_event_nb); + /* + * Before module initialization, some devices may have already been added. + * Register the HPD bridge for these devices. + */ + bus_for_each_dev(&typec_bus, NULL, NULL, check_device_already_added); + return 0; +} + +module_init(drm_aux_hpd_typec_dp_bridge_module_init); +module_exit(drm_aux_hpd_typec_dp_bridge_module_exit); + +MODULE_AUTHOR("Chaoyi Chen "); +MODULE_DESCRIPTION("DRM TYPEC DP HPD BRIDGE"); +MODULE_LICENSE("GPL"); -- 2.53.0 -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy