Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] drm/bridge: analogix_dp: invalid status in analogix_dp_bridge_detect() --
commit fec557a2a8eaddda095ccdaffc8d84d2a1bbe03a Author: Damon Ding <[email protected]> drm/bridge: analogix_dp: Handle HPD notification from downstream bridge This commit adds an hpd_notify_mode to analogix_dp when a downstream bridge in the chain provides HPD notifications without detection. In this mode, the driver caches the connection state from the .hpd_notify callback, mutes and skips initializing native HPD interrupts, and returns connector->status from analogix_dp_bridge_detect(). Link: https://lore.kernel.org/all/5609825.iZASKD2KPV@diego/ > diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c > b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c > index 44d431a89ff6f..12c6650da3a46 100644 > --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c > +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c [ ... ] > @@ -925,6 +926,9 @@ analogix_dp_bridge_detect(struct drm_bridge *bridge, > struct drm_connector *conne > enum drm_connector_status status = connector_status_disconnected; > int ret; > > + if (dp->hpd_notify_mode) > + return connector->status; [Severity: Medium] Can returning connector->status directly from analogix_dp_bridge_detect() cause regressions before the first HPD notification arrives or when connector forcing is used via sysfs? First, drm_connector_init_only() initializes connector->status to connector_status_unknown. In rockchip_drm_bind() and exynos_drm_bind(), drm_kms_helper_poll_init() calls display_connector_hpd_enable(), which only schedules conn->hpd_work asynchronously via schedule_work(&conn->hpd_work) (and when drm_kms_helper.poll=0 or with bridges like aux-hpd-bridge, no initial HPD work is scheduled). When drm_client_setup() -> drm_client_modeset_probe() -> drm_helper_probe_single_connector_modes() (or a userspace DRM_IOCTL_MODE_GETCONNECTOR call) runs before conn->hpd_work completes, analogix_dp_bridge_detect() returns connector_status_unknown. In drivers/gpu/drm/drm_probe_helper.c:drm_helper_probe_single_connector_modes(): if (connector->status == connector_status_disconnected) { ... goto exit; } count = drm_helper_probe_get_modes(connector); if (count == 0 && (connector->status == connector_status_connected || connector->status == connector_status_unknown)) { count = drm_add_modes_noedid(connector, 1024, 768); Because the status is connector_status_unknown instead of connector_status_disconnected, drm_helper_probe_single_connector_modes() adds fallback no-EDID modes and drm_client attempts to enable the disconnected display. In analogix_dp_bridge_atomic_enable() -> analogix_dp_set_bridge(), analogix_dp_detect_hpd() then checks analogix_dp_get_plug_in_status(), where dp->connection_notified is still false, timing out after 5 retries (~500ms) and logging an error. Second, if a user forces the connector state via /sys/class/drm/.../status, drm_helper_probe_single_connector_modes() sets connector->status to the forced value without calling .detect_ctx() or .hpd_notify(), leaving dp->connection_notified out of sync (so forcing "on" still fails in analogix_dp_get_plug_in_status()). When the user later writes "detect" to restore normal detection, status_store() clears connector->force while connector->status still holds the forced state. Then drm_bridge_connector_detect_ctx() runs: if (detect) { status = detect->funcs->detect(detect, connector); ... drm_bridge_connector_hpd_notify(connector, status); } Because analogix_dp_bridge_detect() returns the stale forced connector->status, drm_bridge_connector_hpd_notify() passes that forced status back into analogix_dp_bridge_notify(), overwriting dp->connection_notified and leaving the connector stuck in the forced state until a physical HPD edge occurs. Would it be better to avoid setting DRM_BRIDGE_OP_DETECT on this bridge when downstream HPD is used, or have analogix_dp_bridge_detect() return a valid connected/disconnected status without letting the detect path's drm_bridge_connector_hpd_notify() call overwrite the state from downstream HPD notifications? -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=17
