[PATCH v5 03/18] drm/bridge: analogix_dp: Restrict forced connected status to panel endpoints
From: Damon Ding
Date: Tue Oct 27 2026 - 09:33:38 EST
Limit the forced connected status so that it only applies when the
bridge chain ends with a panel and no downstream bridge supports
DRM_BRIDGE_OP_DETECT, which is tracked by the new
&analogix_dp_device.force_connected_mode. For all the other cases,
rely on analogix_dp_detect_hpd() to report the accurate hotplug
state.
Background for the special handling:
- If the chain ends with a DP connector bridge, the connector relies
on Analogix DP to perform detection. We must avoid hardcoding
connected status here.
- For intermediate bridges such as PS8625 / PTN3460 without detect
support [1], historically the bridge connector defaults to connected
via drm_helper_probe_detect() when no per-bridge detect callback
exists.
[1] https://lore.kernel.org/all/4939d55e-b560-4235-8295-adf8e48d9b74@xxxxxxxxxxx/
Reported-by: Heiko Stuebner <heiko@xxxxxxxxx>
Link: https://lore.kernel.org/all/5209243.oAaWjsssbx@diego/
Tested-by: Heiko Stuebner <heiko@xxxxxxxxx>
Signed-off-by: Damon Ding <damon.ding@xxxxxxxxxxxxxx>
---
Changes in v3:
- Add missing drm_bridge_put() after drm_bridge_chain_get_last_bridge()
to fix a reference count leak. (Sashiko)
- Report panel endpoints as always connected from
analogix_dp_get_plug_in_status() via newly added
&analogix_dp_device.force_connected_mode.
Changes in v4:
- Add Tested-by tag.
Changes in v5:
- Move the force_connected_mode check from
analogix_dp_get_plug_in_status() to analogix_dp_bridge_detect(), as
the hardware status reader is also used by the force HPD fallback
and the AUX HPD waiting paths. (Sashiko)
- Hold a runtime PM reference in analogix_dp_bridge_detect(), since
analogix_dp_detect_hpd() may access the registers while the device
is runtime suspended. (Sashiko)
---
.../drm/bridge/analogix/analogix_dp_core.c | 37 ++++++++++++++++++-
.../drm/bridge/analogix/analogix_dp_core.h | 1 +
2 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index 19f3cec5a691..35b273a803a0 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -904,16 +904,42 @@ analogix_dp_bridge_detect(struct drm_bridge *bridge, struct drm_connector *conne
{
struct analogix_dp_device *dp = to_dp(bridge);
enum drm_connector_status status = connector_status_disconnected;
+ int ret;
- if (dp->bridge.next_bridge)
+ if (dp->force_connected_mode)
return connector_status_connected;
+ ret = pm_runtime_resume_and_get(dp->dev);
+ if (ret)
+ return connector_status_unknown;
+
if (!analogix_dp_detect_hpd(dp))
status = connector_status_connected;
+ pm_runtime_mark_last_busy(dp->dev);
+ pm_runtime_put_autosuspend(dp->dev);
+
return status;
}
+static bool analogix_dp_bridge_force_connected(struct analogix_dp_device *dp)
+{
+ struct drm_bridge *last_bridge;
+ bool force_connected = false;
+
+ drm_for_each_bridge_in_chain_from(dp->bridge.next_bridge, bridge) {
+ if (bridge->ops & DRM_BRIDGE_OP_DETECT)
+ return false;
+ }
+
+ last_bridge = drm_bridge_chain_get_last_bridge(dp->encoder);
+ if (last_bridge)
+ force_connected = drm_bridge_is_panel(last_bridge);
+ drm_bridge_put(last_bridge);
+
+ return force_connected;
+}
+
static int analogix_dp_bridge_attach(struct drm_bridge *bridge,
struct drm_encoder *encoder,
enum drm_bridge_attach_flags flags)
@@ -933,6 +959,15 @@ static int analogix_dp_bridge_attach(struct drm_bridge *bridge,
dev_err(dp->dev, "failed to attach following panel or bridge (%d)\n", ret);
return ret;
}
+
+ /*
+ * Only assume connected when the bridge chain ends with a panel.
+ * Panel bridges lack a detect callback and historically rely on
+ * this shortcut. For other next bridge types (e.g., DP connector
+ * bridges), fall back to analogix_dp_detect_hpd() to report
+ * accurate hotplug state.
+ */
+ dp->force_connected_mode = analogix_dp_bridge_force_connected(dp);
}
return 0;
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
index 4560597604ad..64aaba67e669 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
@@ -170,6 +170,7 @@ struct analogix_dp_device {
bool force_hpd;
bool fast_train_enable;
bool psr_supported;
+ bool force_connected_mode;
u8 dpcd[DP_RECEIVER_CAP_SIZE];
--
2.34.1