[PATCH v6 16/18] drm/bridge: analogix_dp: Declare DRM_BRIDGE_OP_HPD for hotplug reporting
From: Damon Ding
Date: Fri Nov 13 2026 - 03:45:38 EST
This commit declares DRM_BRIDGE_OP_HPD for the analogix_dp bridge,
adds the hpd_enable/hpd_disable bridge callbacks and reports the
hotplug events through drm_bridge_hpd_notify() with the status read
from the HPD GPIO pin or the controller registers.
The DRM_BRIDGE_OP_HPD capability is declared only for the platforms
which support hotplug detection (the GPIO HPD mode, or the native HPD
mode on RK3576 and RK3588), since the drm core stops polling the
connector once DRM_BRIDGE_OP_HPD is declared.
Tested-by: Heiko Stuebner <heiko@xxxxxxxxx>
Tested-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>
Signed-off-by: Damon Ding <damon.ding@xxxxxxxxxxxxxx>
---
Changes in v6:
- Declare DRM_BRIDGE_OP_HPD only for the platforms which support
hotplug detection, since the drm core stops polling the connector
once DRM_BRIDGE_OP_HPD is declared. (Sashiko)
- Add Tested-by tag.
---
.../drm/bridge/analogix/analogix_dp_core.c | 21 ++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index d72b66be6874..9f50163aecf9 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -31,7 +31,6 @@
#include <drm/drm_edid.h>
#include <drm/drm_of.h>
#include <drm/drm_print.h>
-#include <drm/drm_probe_helper.h>
#include <video/of_display_timing.h>
@@ -760,9 +759,13 @@ static irqreturn_t analogix_dp_irq_thread(int irq, void *arg)
hpd_detected = (irq_type & DP_IRQ_TYPE_HP_CABLE_IN) ||
(irq_type & DP_IRQ_TYPE_HP_CABLE_OUT);
if (hpd_detected) {
+ enum drm_connector_status status;
+
dev_dbg(dp->dev, "Detected cable status changed!\n");
- if (dp->drm_dev)
- drm_helper_hpd_irq_event(dp->drm_dev);
+
+ status = analogix_dp_get_plug_in_status(dp) == 0 ? connector_status_connected :
+ connector_status_disconnected;
+ drm_bridge_hpd_notify(&dp->bridge, status);
}
if (!dp->hpd_gpiod) {
@@ -1301,6 +1304,14 @@ static void analogix_dp_bridge_atomic_post_disable(struct drm_bridge *bridge,
DRM_ERROR("Failed to enable psr (%d)\n", ret);
}
+static void analogix_dp_bridge_hpd_enable(struct drm_bridge *bridge)
+{
+}
+
+static void analogix_dp_bridge_hpd_disable(struct drm_bridge *bridge)
+{
+}
+
static const struct drm_bridge_funcs analogix_dp_bridge_funcs = {
.atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
@@ -1313,6 +1324,8 @@ static const struct drm_bridge_funcs analogix_dp_bridge_funcs = {
.attach = analogix_dp_bridge_attach,
.edid_read = analogix_dp_bridge_edid_read,
.detect = analogix_dp_bridge_detect,
+ .hpd_enable = analogix_dp_bridge_hpd_enable,
+ .hpd_disable = analogix_dp_bridge_hpd_disable,
};
static int analogix_dp_dt_parse_lanes_map(struct analogix_dp_device *dp)
@@ -1634,6 +1647,8 @@ int analogix_dp_bind(struct analogix_dp_device *dp, struct drm_device *drm_dev)
}
bridge->ops = DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_DETECT;
+ if (analogix_dp_supports_hpd(dp))
+ bridge->ops |= DRM_BRIDGE_OP_HPD;
bridge->of_node = dp->dev->of_node;
bridge->type = DRM_MODE_CONNECTOR_eDP;
ret = devm_drm_bridge_add(dp->dev, &dp->bridge);
--
2.34.1