From: Chaoyi Chen <kernel@airkyi.com>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>, Vinod Koul <vkoul@kernel.org>,
Kishon Vijay Abraham I <kishon@kernel.org>,
Heiko Stuebner <heiko@sntech.de>,
Sandy Huang <hjc@rock-chips.com>,
Andy Yan <andy.yan@rock-chips.com>,
Yubing Zhang <yubing.zhang@rock-chips.com>,
Frank Wang <frank.wang@rock-chips.com>,
Andrzej Hajda <andrzej.hajda@intel.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Robert Foss <rfoss@kernel.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Amit Sunil Dhamne <amitsd@google.com>,
Chaoyi Chen <chaoyi.chen@rock-chips.com>,
Dragan Simic <dsimic@manjaro.org>,
Johan Jonker <jbx6244@gmail.com>,
Diederik de Haas <didi.debian@cknow.org>,
Peter Robinson <pbrobinson@gmail.com>
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 v8 03/10] drm/bridge: Implement generic USB Type-C DP HPD bridge
Date: Wed, 29 Oct 2025 15:14:28 +0800 [thread overview]
Message-ID: <20251029071435.88-4-kernel@airkyi.com> (raw)
In-Reply-To: <20251029071435.88-1-kernel@airkyi.com>
From: Chaoyi Chen <chaoyi.chen@rock-chips.com>
Several USB-C controller drivers have already implemented the DP HPD
bridge function provided by aux-hpd-bridge.c, but there are still
some USB-C controller driver that have not yet implemented it.
This patch implements a generic DP HPD bridge based on aux-hpd-bridge.c,
so that other USB-C controller drivers don't need to implement it again.
Signed-off-by: Chaoyi Chen <chaoyi.chen@rock-chips.com>
---
Changes in v8:
- Merge generic DP HPD bridge into one module.
drivers/gpu/drm/bridge/Kconfig | 5 +-
drivers/gpu/drm/bridge/Makefile | 8 +++-
drivers/gpu/drm/bridge/aux-hpd-bridge.c | 23 ++++++++-
drivers/gpu/drm/bridge/aux-hpd-bridge.h | 13 +++++
.../gpu/drm/bridge/aux-hpd-typec-dp-bridge.c | 47 +++++++++++++++++++
5 files changed, 93 insertions(+), 3 deletions(-)
create mode 100644 drivers/gpu/drm/bridge/aux-hpd-bridge.h
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..17257b223a28 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -23,13 +23,16 @@ config DRM_AUX_BRIDGE
build bridges chain.
config DRM_AUX_HPD_BRIDGE
- tristate
+ tristate "AUX HPD bridge support"
depends on DRM_BRIDGE && OF
select AUXILIARY_BUS
help
Simple bridge that terminates the bridge chain and provides HPD
support.
+ Specifically, if you want a default Type-C DisplayPort HPD bridge for
+ each port of the Type-C controller, say Y here.
+
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..2998937444bc 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -1,6 +1,12 @@
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_DRM_AUX_BRIDGE) += aux-bridge.o
-obj-$(CONFIG_DRM_AUX_HPD_BRIDGE) += aux-hpd-bridge.o
+
+hpd-bridge-y := aux-hpd-bridge.o
+ifneq ($(CONFIG_TYPEC),)
+hpd-bridge-y += aux-hpd-typec-dp-bridge.o
+endif
+obj-$(CONFIG_DRM_AUX_HPD_BRIDGE) += hpd-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-bridge.c b/drivers/gpu/drm/bridge/aux-hpd-bridge.c
index 2e9c702c7087..11ad6dc776c7 100644
--- a/drivers/gpu/drm/bridge/aux-hpd-bridge.c
+++ b/drivers/gpu/drm/bridge/aux-hpd-bridge.c
@@ -12,6 +12,8 @@
#include <drm/drm_bridge.h>
#include <drm/bridge/aux-bridge.h>
+#include "aux-hpd-bridge.h"
+
static DEFINE_IDA(drm_aux_hpd_bridge_ida);
struct drm_aux_hpd_bridge_data {
@@ -204,7 +206,26 @@ static struct auxiliary_driver drm_aux_hpd_bridge_drv = {
.id_table = drm_aux_hpd_bridge_table,
.probe = drm_aux_hpd_bridge_probe,
};
-module_auxiliary_driver(drm_aux_hpd_bridge_drv);
+
+static int drm_aux_hpd_bridge_mod_init(void)
+{
+ int ret;
+
+ ret = auxiliary_driver_register(&drm_aux_hpd_bridge_drv);
+ if (ret)
+ return ret;
+
+ return drm_aux_hpd_typec_dp_bridge_init();
+}
+
+static void drm_aux_hpd_bridge_mod_exit(void)
+{
+ drm_aux_hpd_typec_dp_bridge_exit();
+ auxiliary_driver_unregister(&drm_aux_hpd_bridge_drv);
+}
+
+module_init(drm_aux_hpd_bridge_mod_init);
+module_exit(drm_aux_hpd_bridge_mod_exit);
MODULE_AUTHOR("Dmitry Baryshkov <dmitry.baryshkov@linaro.org>");
MODULE_DESCRIPTION("DRM HPD bridge");
diff --git a/drivers/gpu/drm/bridge/aux-hpd-bridge.h b/drivers/gpu/drm/bridge/aux-hpd-bridge.h
new file mode 100644
index 000000000000..69364731c2f1
--- /dev/null
+++ b/drivers/gpu/drm/bridge/aux-hpd-bridge.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef AUX_HPD_BRIDGE_H
+#define AUX_HPD_BRIDGE_H
+
+#if IS_REACHABLE(CONFIG_TYPEC)
+int drm_aux_hpd_typec_dp_bridge_init(void);
+void drm_aux_hpd_typec_dp_bridge_exit(void);
+#else
+static inline int drm_aux_hpd_typec_dp_bridge_init(void) { return 0; }
+static inline void drm_aux_hpd_typec_dp_bridge_exit(void) { }
+#endif /* IS_REACHABLE(CONFIG_TYPEC) */
+
+#endif /* AUX_HPD_BRIDGE_H */
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..6f2a1fca0fc5
--- /dev/null
+++ b/drivers/gpu/drm/bridge/aux-hpd-typec-dp-bridge.c
@@ -0,0 +1,47 @@
+// SPDX-License-Identifier: GPL-2.0+
+#include <linux/of.h>
+#include <linux/usb/typec_altmode.h>
+#include <linux/usb/typec_dp.h>
+#include <linux/usb/typec_notify.h>
+
+#include <drm/bridge/aux-bridge.h>
+
+#include "aux-hpd-bridge.h"
+
+#if IS_REACHABLE(CONFIG_TYPEC)
+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,
+};
+
+int drm_aux_hpd_typec_dp_bridge_init(void)
+{
+ return typec_altmode_register_notify(&drm_typec_event_nb);
+}
+
+void drm_aux_hpd_typec_dp_bridge_exit(void)
+{
+ typec_altmode_unregister_notify(&drm_typec_event_nb);
+}
+#endif
--
2.49.0
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
next prev parent reply other threads:[~2025-10-29 7:15 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-29 7:14 [PATCH v8 00/10] Add Type-C DP support for RK3399 EVB IND board Chaoyi Chen
2025-10-29 7:14 ` [PATCH v8 01/10] usb: typec: Add notifier functions Chaoyi Chen
2025-10-31 13:39 ` Heikki Krogerus
2025-11-03 1:11 ` Chaoyi Chen
2025-10-29 7:14 ` [PATCH v8 02/10] usb: typec: Export all typec device types Chaoyi Chen
2025-10-31 13:49 ` Heikki Krogerus
2025-10-29 7:14 ` Chaoyi Chen [this message]
2025-10-31 13:58 ` [PATCH v8 03/10] drm/bridge: Implement generic USB Type-C DP HPD bridge Heikki Krogerus
2025-11-03 1:15 ` Chaoyi Chen
2025-11-03 4:00 ` Dmitry Baryshkov
2025-11-03 6:24 ` Chaoyi Chen
2025-11-03 13:48 ` Heikki Krogerus
2025-11-04 1:18 ` Chaoyi Chen
2025-11-06 3:06 ` Chaoyi Chen
2025-10-29 7:14 ` [PATCH v8 04/10] dt-bindings: phy: rockchip: rk3399-typec-phy: Support mode-switch Chaoyi Chen
2025-10-29 7:14 ` [PATCH v8 05/10] phy: rockchip: phy-rockchip-typec: Add typec_mux/typec_switch support Chaoyi Chen
2025-10-29 7:14 ` [PATCH v8 06/10] phy: rockchip: phy-rockchip-typec: Add DRM AUX bridge Chaoyi Chen
2025-10-29 7:14 ` [PATCH v8 07/10] drm/rockchip: cdn-dp: Support handle lane info without extcon Chaoyi Chen
2025-10-29 7:14 ` [PATCH v8 08/10] drm/rockchip: cdn-dp: Add multiple bridges to support PHY port selection Chaoyi Chen
2025-10-29 7:14 ` [PATCH v8 09/10] arm64: dts: rockchip: Add missing dp_out port for RK3399 CDN-DP Chaoyi Chen
2025-10-29 7:14 ` [PATCH v8 10/10] arm64: dts: rockchip: rk3399-evb-ind: Add support for DisplayPort Chaoyi Chen
2025-10-29 9:45 ` Peter Chen
2025-10-29 10:21 ` Chaoyi Chen
2025-10-29 10:31 ` Chaoyi Chen
2025-10-30 1:34 ` Peter Chen
2025-10-30 2:16 ` Chaoyi Chen
2025-10-30 2:50 ` Peter Chen
2025-10-30 3:13 ` Chaoyi Chen
2025-10-30 6:13 ` Peter Chen
2025-10-30 6:50 ` Chaoyi Chen
2025-10-31 2:57 ` Peter Chen (CIX)
2025-10-31 3:08 ` Chaoyi Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251029071435.88-4-kernel@airkyi.com \
--to=kernel@airkyi.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=amitsd@google.com \
--cc=andrzej.hajda@intel.com \
--cc=andy.yan@rock-chips.com \
--cc=chaoyi.chen@rock-chips.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=didi.debian@cknow.org \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=dsimic@manjaro.org \
--cc=frank.wang@rock-chips.com \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=heiko@sntech.de \
--cc=hjc@rock-chips.com \
--cc=jbx6244@gmail.com \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=kishon@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=pbrobinson@gmail.com \
--cc=rfoss@kernel.org \
--cc=robh@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
--cc=vkoul@kernel.org \
--cc=yubing.zhang@rock-chips.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox