From mboxrd@z Thu Jan 1 00:00:00 1970 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 92E8FCCFA1A for ; Tue, 11 Nov 2025 10:52:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: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:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=qha7kTMIFWTImkRefy7JrZ1sr78KHWgow87P2iHBbnU=; b=TH9rSKxqJnS1gnlml7HHXA11q3 SLxnqfvbIjDRHv7aPIE1jQVa+ldQV+X1FG1vIcp4heomiu56DZWTB1xJYaM5t1KbHhl9PM9lWYq+i yGjGJypZRThYM4HkwaJdyESNdQBKK4Lu5cQ9vQi8UXW81EIDNzY+wQzD3agX0jPDwGhyYLBn1jl4O PhtIbRxv5xuxKA3YkibWTOfXeYxuy3xSyozMGsxtjTDaxxl+j0WSqYsQA9Fyv7sGKhzUy/pV7/EO8 38/mVhRBmqF5O9ML6Nd++pFaZmrkQVqM5tDDGc726USPrHR/UhOraQajR+aUudMnHDvctqHXByYRB zEx5BWyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vIlye-000000070D4-1VLc; Tue, 11 Nov 2025 10:51:56 +0000 Received: from smtpbgjp3.qq.com ([54.92.39.34]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vIlyX-00000006zsW-3Dy9; Tue, 11 Nov 2025 10:51:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=airkyi.com; s=altu2504; t=1762858273; bh=qha7kTMIFWTImkRefy7JrZ1sr78KHWgow87P2iHBbnU=; h=From:To:Subject:Date:Message-Id; b=aicK2kq7Epc5llmjuUIug9nZNM5Q9dXJYIV1lLVPWXAE2ZdsCF83oLcFbHlRt4ML7 6B7EUxu06o2Y3sd7tkITgUszDKPQHeBsIPFkDsubUs+MbN388IBzbOu1z+Ow/0O7Ip jPZwzTMRY4VgPB+LpuLCl85a5EY0L3u+kmtlduag= X-QQ-mid: zesmtpsz9t1762858260t14c220c6 X-QQ-Originating-IP: 8yzyQt1WcUQiRY5qQzutWDddM3dqogZr+H0JtzK+Gg8= Received: from DESKTOP-8BT1A2O.localdomain ( [58.22.7.114]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 11 Nov 2025 18:50:57 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 16669197487587565882 From: Chaoyi Chen To: Heikki Krogerus , Greg Kroah-Hartman , Dmitry Baryshkov , Peter Chen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Vinod Koul , Kishon Vijay Abraham I , Heiko Stuebner , Sandy Huang , Andy Yan , Yubing Zhang , Frank Wang , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Amit Sunil Dhamne , Chaoyi Chen , Dragan Simic , Johan Jonker , Diederik de Haas , Peter Robinson Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: [PATCH v9 03/10] drm/bridge: Implement generic USB Type-C DP HPD bridge Date: Tue, 11 Nov 2025 18:50:33 +0800 Message-Id: <20251111105040.94-4-kernel@airkyi.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20251111105040.94-1-kernel@airkyi.com> References: <20251111105040.94-1-kernel@airkyi.com> X-QQ-SENDSIZE: 520 Feedback-ID: zesmtpsz:airkyi.com:qybglogicsvrgz:qybglogicsvrgz6b-0 X-QQ-XMAILINFO: MVbvI5amSZ2YjBsber5S6w9K30nV5pAfS1taUYJwjKnNBZTkwP0yN0Dh DzzOsDJ2vnJg2naTHIjSrO4Ety1SfQg47Hy1ssKwxIidE4I7kd/bEME04WdDPR3DXlhYynK /TCIcnnXmgLOcHjr+h6UX1Osk2DfXs2UFCUzZhKQUgQc+o/hir7/Tyc+dxljZiEUSo+mmjX Lg6xHFoJZ4dFIr9Eu43rgwftMm2fHctzh+qpyxh1kss7nqGCjtdFDaesznTxdlbGTGtXbYp zx5Chr3hWcrgZicFLI4Kf3M+48BPPHuLdbSrhsB0jFlXfJ+gr83roCtZUQcMuX5Bb/Lcwst WS1Riu+B/US+uoKMZwERYx6VJZ1JlnthhBm0ficImpF2cARJttL5e+OecUVAPcnIM6pYLn6 wjyfkp3C3ycnyaN/Xus4oqm7bnDIQRyOgzmbXshoIp4NRVKAirFo4xqJTZNXK4O1mCtW6RF fiGBmHnDt1noeHZ18DcyWsAI5ivbANJ6jYSLZNHFnh7yPLzsxhbEqXO7Vwt372vNFV2YZ+O uVn6HoLCvqvD9hA11sh8fap1y7nJq048QkU2kvsamYDdP8/6npR5+9JQCIXLJRijKZyZljT 2ZctNdm63r+Kt0iESrce5OCZEoB303v2b0XyOqpvqduTzDtQzy46DfCFzWxRQf5SSfGF1x5 SXDcU4C4AkcpP5ZAPLKWZSK3R1fqc3a6FDyRXSWcFWdfwf3WUqA6Jl+HtwKMVvafEnLMTFY rsawZhI5CbndEkPlaY69j0Q4usMctOiIdvgwmXOf45OqNdXPLxkj4kCppob598Jt/ax7/67 vz4Si5oMuhrVNcFsWKjXNdye7zaY5C3zGPhV/pFpj3O2VMRXib7PR1Hj7OwBlRbuZYxVeWB Y8WfH0Mlo5zz6uZOmxnXn2F5z2P7BjAR5AsC+WXJ3EijMHIB70ajK+vYIM6VoBS/rAIND4T TB05FYoGj3Pgg6qpHSaq6TFy72+5568MM+prx0NzzKDwLFCcbqTJoblhRUlpp5hZSfgi48E 1Wj+BiqjwcSmUkfDCJUW7zBa9fRUxAsHqc35fmLg== X-QQ-XMRINFO: NyFYKkN4Ny6FSmKK/uo/jdU= X-QQ-RECHKSPAM: 0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251111_025150_095124_C89A80DB X-CRM114-Status: GOOD ( 20.34 ) 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 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 --- Changes in v9: - Remove the exposed DRM_AUX_HPD_BRIDGE option, and select DRM_AUX_HPD_TYPEC_BRIDGE when it is available. - Add more commit comment about problem background. Changes in v8: - Merge generic DP HPD bridge into one module. drivers/gpu/drm/bridge/Kconfig | 10 ++++ drivers/gpu/drm/bridge/Makefile | 1 + .../gpu/drm/bridge/aux-hpd-typec-dp-bridge.c | 50 +++++++++++++++++++ 3 files changed, 61 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 a250afd8d662..559487aa09a9 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 c7dc03182e59..a3a0393d2e72 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..9cb6a0cb0f0a --- /dev/null +++ b/drivers/gpu/drm/bridge/aux-hpd-typec-dp-bridge.c @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: GPL-2.0+ +#include +#include +#include + +#include + +static int drm_typec_bus_event(struct notifier_block *nb, + unsigned long action, void *data) +{ + struct typec_altmode *alt = (struct typec_altmode *)data; + + if (action != TYPEC_ALTMODE_REGISTERED) + goto done; + + if (is_typec_partner(&alt->dev) || alt->svid != USB_TYPEC_DP_SID) + goto done; + + /* + * alt->dev.parent->parent : USB-C controller device + * alt->dev.parent : USB-C connector device + */ + drm_dp_hpd_bridge_register(alt->dev.parent->parent, + to_of_node(alt->dev.parent->fwnode)); + +done: + return NOTIFY_OK; +} + +static struct notifier_block drm_typec_event_nb = { + .notifier_call = drm_typec_bus_event, +}; + +static void drm_aux_hpd_typec_dp_bridge_module_exit(void) +{ + typec_altmode_unregister_notify(&drm_typec_event_nb); +} + +static int __init drm_aux_hpd_typec_dp_bridge_module_init(void) +{ + typec_altmode_register_notify(&drm_typec_event_nb); + + return 0; +} + +module_init(drm_aux_hpd_typec_dp_bridge_module_init); +module_exit(drm_aux_hpd_typec_dp_bridge_module_exit); + +MODULE_DESCRIPTION("DRM TYPEC DP HPD BRIDGE"); +MODULE_LICENSE("GPL"); -- 2.51.1 From mboxrd@z Thu Jan 1 00:00:00 1970 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 59496CD1297 for ; Tue, 11 Nov 2025 10:51:54 +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: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=E5QcQMVNvcSEFYQDKko1UJf9Um81ulTUHPFV3NmU4Ro=; b=FJeiOPdmqT8EH/ FFc0hR6yFJMkzapKdLHdrHzLwtTvPLrJV2w7IEAMYcdKtcQgrnOj23XcNiDRRgF2ciuRmH17oefwz //OVOuSXgWrxPSf1wo8aYgZseeakdX4SbpMj95QaNM5LtZAB+ri6YS2a+MZjRtcjs6ZEg2z+HL53f 8kUjrJzIb1EAl0FI2toOrc7uRob2j+VFE8XulH+ytdayXvBAVgm5Y63BJZzQfu2YnRv607Ai1bUvv OZFOfECeuvl4vOiuK6NfYjy9pi+R4LkYVWdqkkgupT+GcnXHIImvtPk4fv5QZGvVSC5es3uLTvdyI +4eF+hp68aTYjzvjzEyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vIlyc-000000070AQ-055X; Tue, 11 Nov 2025 10:51:54 +0000 Received: from smtpbgjp3.qq.com ([54.92.39.34]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vIlyX-00000006zsW-3Dy9; Tue, 11 Nov 2025 10:51:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=airkyi.com; s=altu2504; t=1762858273; bh=qha7kTMIFWTImkRefy7JrZ1sr78KHWgow87P2iHBbnU=; h=From:To:Subject:Date:Message-Id; b=aicK2kq7Epc5llmjuUIug9nZNM5Q9dXJYIV1lLVPWXAE2ZdsCF83oLcFbHlRt4ML7 6B7EUxu06o2Y3sd7tkITgUszDKPQHeBsIPFkDsubUs+MbN388IBzbOu1z+Ow/0O7Ip jPZwzTMRY4VgPB+LpuLCl85a5EY0L3u+kmtlduag= X-QQ-mid: zesmtpsz9t1762858260t14c220c6 X-QQ-Originating-IP: 8yzyQt1WcUQiRY5qQzutWDddM3dqogZr+H0JtzK+Gg8= Received: from DESKTOP-8BT1A2O.localdomain ( [58.22.7.114]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 11 Nov 2025 18:50:57 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 16669197487587565882 From: Chaoyi Chen To: Heikki Krogerus , Greg Kroah-Hartman , Dmitry Baryshkov , Peter Chen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Vinod Koul , Kishon Vijay Abraham I , Heiko Stuebner , Sandy Huang , Andy Yan , Yubing Zhang , Frank Wang , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Amit Sunil Dhamne , Chaoyi Chen , Dragan Simic , Johan Jonker , Diederik de Haas , Peter Robinson Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: [PATCH v9 03/10] drm/bridge: Implement generic USB Type-C DP HPD bridge Date: Tue, 11 Nov 2025 18:50:33 +0800 Message-Id: <20251111105040.94-4-kernel@airkyi.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20251111105040.94-1-kernel@airkyi.com> References: <20251111105040.94-1-kernel@airkyi.com> X-QQ-SENDSIZE: 520 Feedback-ID: zesmtpsz:airkyi.com:qybglogicsvrgz:qybglogicsvrgz6b-0 X-QQ-XMAILINFO: MVbvI5amSZ2YjBsber5S6w9K30nV5pAfS1taUYJwjKnNBZTkwP0yN0Dh DzzOsDJ2vnJg2naTHIjSrO4Ety1SfQg47Hy1ssKwxIidE4I7kd/bEME04WdDPR3DXlhYynK /TCIcnnXmgLOcHjr+h6UX1Osk2DfXs2UFCUzZhKQUgQc+o/hir7/Tyc+dxljZiEUSo+mmjX Lg6xHFoJZ4dFIr9Eu43rgwftMm2fHctzh+qpyxh1kss7nqGCjtdFDaesznTxdlbGTGtXbYp zx5Chr3hWcrgZicFLI4Kf3M+48BPPHuLdbSrhsB0jFlXfJ+gr83roCtZUQcMuX5Bb/Lcwst WS1Riu+B/US+uoKMZwERYx6VJZ1JlnthhBm0ficImpF2cARJttL5e+OecUVAPcnIM6pYLn6 wjyfkp3C3ycnyaN/Xus4oqm7bnDIQRyOgzmbXshoIp4NRVKAirFo4xqJTZNXK4O1mCtW6RF fiGBmHnDt1noeHZ18DcyWsAI5ivbANJ6jYSLZNHFnh7yPLzsxhbEqXO7Vwt372vNFV2YZ+O uVn6HoLCvqvD9hA11sh8fap1y7nJq048QkU2kvsamYDdP8/6npR5+9JQCIXLJRijKZyZljT 2ZctNdm63r+Kt0iESrce5OCZEoB303v2b0XyOqpvqduTzDtQzy46DfCFzWxRQf5SSfGF1x5 SXDcU4C4AkcpP5ZAPLKWZSK3R1fqc3a6FDyRXSWcFWdfwf3WUqA6Jl+HtwKMVvafEnLMTFY rsawZhI5CbndEkPlaY69j0Q4usMctOiIdvgwmXOf45OqNdXPLxkj4kCppob598Jt/ax7/67 vz4Si5oMuhrVNcFsWKjXNdye7zaY5C3zGPhV/pFpj3O2VMRXib7PR1Hj7OwBlRbuZYxVeWB Y8WfH0Mlo5zz6uZOmxnXn2F5z2P7BjAR5AsC+WXJ3EijMHIB70ajK+vYIM6VoBS/rAIND4T TB05FYoGj3Pgg6qpHSaq6TFy72+5568MM+prx0NzzKDwLFCcbqTJoblhRUlpp5hZSfgi48E 1Wj+BiqjwcSmUkfDCJUW7zBa9fRUxAsHqc35fmLg== X-QQ-XMRINFO: NyFYKkN4Ny6FSmKK/uo/jdU= X-QQ-RECHKSPAM: 0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251111_025150_095124_C89A80DB X-CRM114-Status: GOOD ( 20.34 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org 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 --- Changes in v9: - Remove the exposed DRM_AUX_HPD_BRIDGE option, and select DRM_AUX_HPD_TYPEC_BRIDGE when it is available. - Add more commit comment about problem background. Changes in v8: - Merge generic DP HPD bridge into one module. drivers/gpu/drm/bridge/Kconfig | 10 ++++ drivers/gpu/drm/bridge/Makefile | 1 + .../gpu/drm/bridge/aux-hpd-typec-dp-bridge.c | 50 +++++++++++++++++++ 3 files changed, 61 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 a250afd8d662..559487aa09a9 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 c7dc03182e59..a3a0393d2e72 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..9cb6a0cb0f0a --- /dev/null +++ b/drivers/gpu/drm/bridge/aux-hpd-typec-dp-bridge.c @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: GPL-2.0+ +#include +#include +#include + +#include + +static int drm_typec_bus_event(struct notifier_block *nb, + unsigned long action, void *data) +{ + struct typec_altmode *alt = (struct typec_altmode *)data; + + if (action != TYPEC_ALTMODE_REGISTERED) + goto done; + + if (is_typec_partner(&alt->dev) || alt->svid != USB_TYPEC_DP_SID) + goto done; + + /* + * alt->dev.parent->parent : USB-C controller device + * alt->dev.parent : USB-C connector device + */ + drm_dp_hpd_bridge_register(alt->dev.parent->parent, + to_of_node(alt->dev.parent->fwnode)); + +done: + return NOTIFY_OK; +} + +static struct notifier_block drm_typec_event_nb = { + .notifier_call = drm_typec_bus_event, +}; + +static void drm_aux_hpd_typec_dp_bridge_module_exit(void) +{ + typec_altmode_unregister_notify(&drm_typec_event_nb); +} + +static int __init drm_aux_hpd_typec_dp_bridge_module_init(void) +{ + typec_altmode_register_notify(&drm_typec_event_nb); + + return 0; +} + +module_init(drm_aux_hpd_typec_dp_bridge_module_init); +module_exit(drm_aux_hpd_typec_dp_bridge_module_exit); + +MODULE_DESCRIPTION("DRM TYPEC DP HPD BRIDGE"); +MODULE_LICENSE("GPL"); -- 2.51.1 -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy From mboxrd@z Thu Jan 1 00:00:00 1970 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 89F0ECD1297 for ; Tue, 11 Nov 2025 10:51:57 +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: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=8FWs+u35McRE1hIjlIfxSnO2L2Z3v9bysn8zNQqnr/o=; b=SsQsjHYMCUSCXT c8uVuTn4bJLQfgjpI0WEFiZ2lydcWMN3d6I27W/GTYMV8gr3l8y2/pV6zrnq7Hz1xEQrFsKIC8hwQ H9m49EvtWZvFTxbpB5bG2XdokKX+QxDey8qUHJV0VUzZx4ZKfxFaQhmOQVMFsQxqlTUpQWqpseBQ0 8fec79ulS8MM1itW4Lcyv2emNIsX3nh4YtZx+nplpihg4+QUGy79XfAIiZGh7PAdYEQaoVREJJ1d/ vtWpAVAlrka9VH49vcHTA7V3M93XW+++ZygPWRK7l3midD1ozrfIgJYv1970BC2Ka9ZxnyZoGCD46 nuXyNRyPkywUG6LTCBIA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vIlyc-000000070An-1IjP; Tue, 11 Nov 2025 10:51:54 +0000 Received: from smtpbgjp3.qq.com ([54.92.39.34]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vIlyX-00000006zsW-3Dy9; Tue, 11 Nov 2025 10:51:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=airkyi.com; s=altu2504; t=1762858273; bh=qha7kTMIFWTImkRefy7JrZ1sr78KHWgow87P2iHBbnU=; h=From:To:Subject:Date:Message-Id; b=aicK2kq7Epc5llmjuUIug9nZNM5Q9dXJYIV1lLVPWXAE2ZdsCF83oLcFbHlRt4ML7 6B7EUxu06o2Y3sd7tkITgUszDKPQHeBsIPFkDsubUs+MbN388IBzbOu1z+Ow/0O7Ip jPZwzTMRY4VgPB+LpuLCl85a5EY0L3u+kmtlduag= X-QQ-mid: zesmtpsz9t1762858260t14c220c6 X-QQ-Originating-IP: 8yzyQt1WcUQiRY5qQzutWDddM3dqogZr+H0JtzK+Gg8= Received: from DESKTOP-8BT1A2O.localdomain ( [58.22.7.114]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 11 Nov 2025 18:50:57 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 16669197487587565882 From: Chaoyi Chen To: Heikki Krogerus , Greg Kroah-Hartman , Dmitry Baryshkov , Peter Chen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Vinod Koul , Kishon Vijay Abraham I , Heiko Stuebner , Sandy Huang , Andy Yan , Yubing Zhang , Frank Wang , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Amit Sunil Dhamne , Chaoyi Chen , Dragan Simic , Johan Jonker , Diederik de Haas , Peter Robinson Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: [PATCH v9 03/10] drm/bridge: Implement generic USB Type-C DP HPD bridge Date: Tue, 11 Nov 2025 18:50:33 +0800 Message-Id: <20251111105040.94-4-kernel@airkyi.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20251111105040.94-1-kernel@airkyi.com> References: <20251111105040.94-1-kernel@airkyi.com> X-QQ-SENDSIZE: 520 Feedback-ID: zesmtpsz:airkyi.com:qybglogicsvrgz:qybglogicsvrgz6b-0 X-QQ-XMAILINFO: MVbvI5amSZ2YjBsber5S6w9K30nV5pAfS1taUYJwjKnNBZTkwP0yN0Dh DzzOsDJ2vnJg2naTHIjSrO4Ety1SfQg47Hy1ssKwxIidE4I7kd/bEME04WdDPR3DXlhYynK /TCIcnnXmgLOcHjr+h6UX1Osk2DfXs2UFCUzZhKQUgQc+o/hir7/Tyc+dxljZiEUSo+mmjX Lg6xHFoJZ4dFIr9Eu43rgwftMm2fHctzh+qpyxh1kss7nqGCjtdFDaesznTxdlbGTGtXbYp zx5Chr3hWcrgZicFLI4Kf3M+48BPPHuLdbSrhsB0jFlXfJ+gr83roCtZUQcMuX5Bb/Lcwst WS1Riu+B/US+uoKMZwERYx6VJZ1JlnthhBm0ficImpF2cARJttL5e+OecUVAPcnIM6pYLn6 wjyfkp3C3ycnyaN/Xus4oqm7bnDIQRyOgzmbXshoIp4NRVKAirFo4xqJTZNXK4O1mCtW6RF fiGBmHnDt1noeHZ18DcyWsAI5ivbANJ6jYSLZNHFnh7yPLzsxhbEqXO7Vwt372vNFV2YZ+O uVn6HoLCvqvD9hA11sh8fap1y7nJq048QkU2kvsamYDdP8/6npR5+9JQCIXLJRijKZyZljT 2ZctNdm63r+Kt0iESrce5OCZEoB303v2b0XyOqpvqduTzDtQzy46DfCFzWxRQf5SSfGF1x5 SXDcU4C4AkcpP5ZAPLKWZSK3R1fqc3a6FDyRXSWcFWdfwf3WUqA6Jl+HtwKMVvafEnLMTFY rsawZhI5CbndEkPlaY69j0Q4usMctOiIdvgwmXOf45OqNdXPLxkj4kCppob598Jt/ax7/67 vz4Si5oMuhrVNcFsWKjXNdye7zaY5C3zGPhV/pFpj3O2VMRXib7PR1Hj7OwBlRbuZYxVeWB Y8WfH0Mlo5zz6uZOmxnXn2F5z2P7BjAR5AsC+WXJ3EijMHIB70ajK+vYIM6VoBS/rAIND4T TB05FYoGj3Pgg6qpHSaq6TFy72+5568MM+prx0NzzKDwLFCcbqTJoblhRUlpp5hZSfgi48E 1Wj+BiqjwcSmUkfDCJUW7zBa9fRUxAsHqc35fmLg== X-QQ-XMRINFO: NyFYKkN4Ny6FSmKK/uo/jdU= X-QQ-RECHKSPAM: 0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251111_025150_095124_C89A80DB X-CRM114-Status: GOOD ( 20.34 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org 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 --- Changes in v9: - Remove the exposed DRM_AUX_HPD_BRIDGE option, and select DRM_AUX_HPD_TYPEC_BRIDGE when it is available. - Add more commit comment about problem background. Changes in v8: - Merge generic DP HPD bridge into one module. drivers/gpu/drm/bridge/Kconfig | 10 ++++ drivers/gpu/drm/bridge/Makefile | 1 + .../gpu/drm/bridge/aux-hpd-typec-dp-bridge.c | 50 +++++++++++++++++++ 3 files changed, 61 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 a250afd8d662..559487aa09a9 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 c7dc03182e59..a3a0393d2e72 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..9cb6a0cb0f0a --- /dev/null +++ b/drivers/gpu/drm/bridge/aux-hpd-typec-dp-bridge.c @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: GPL-2.0+ +#include +#include +#include + +#include + +static int drm_typec_bus_event(struct notifier_block *nb, + unsigned long action, void *data) +{ + struct typec_altmode *alt = (struct typec_altmode *)data; + + if (action != TYPEC_ALTMODE_REGISTERED) + goto done; + + if (is_typec_partner(&alt->dev) || alt->svid != USB_TYPEC_DP_SID) + goto done; + + /* + * alt->dev.parent->parent : USB-C controller device + * alt->dev.parent : USB-C connector device + */ + drm_dp_hpd_bridge_register(alt->dev.parent->parent, + to_of_node(alt->dev.parent->fwnode)); + +done: + return NOTIFY_OK; +} + +static struct notifier_block drm_typec_event_nb = { + .notifier_call = drm_typec_bus_event, +}; + +static void drm_aux_hpd_typec_dp_bridge_module_exit(void) +{ + typec_altmode_unregister_notify(&drm_typec_event_nb); +} + +static int __init drm_aux_hpd_typec_dp_bridge_module_init(void) +{ + typec_altmode_register_notify(&drm_typec_event_nb); + + return 0; +} + +module_init(drm_aux_hpd_typec_dp_bridge_module_init); +module_exit(drm_aux_hpd_typec_dp_bridge_module_exit); + +MODULE_DESCRIPTION("DRM TYPEC DP HPD BRIDGE"); +MODULE_LICENSE("GPL"); -- 2.51.1 _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip