Re: [PATCH] drm/bridge: aux-hpd-bridge: replay last HPD status on hpd_enable

From: Joonhoe Kim

Date: Fri Nov 06 2026 - 21:12:26 EST


On Mon, 03 Aug 2026 16:43:08 +0800, Yongxing Mou wrote:
> If a downstream consumer (e.g. drm_bridge_connector attached by the
> msm/dp driver) registers its HPD callback after an upstream driver
> has already reported a HPD event through drm_aux_hpd_bridge_notify(),
> the notification is dropped because bridge->hpd_cb is still NULL.

The same happens on the Lenovo Y700 Gen 5 (TB323FU, Kaanapali) with a
monitor attached at boot, when pmic_glink_altmode probes late because a
mode switch it waits for is a module. A kprobe trace shows the HPD event
from pmic_glink_altmode arriving with no hpd_cb set, and the DP driver
enabling HPD about 2.6 s later.

On the two Sashiko points: I tested a variant that replays the status
from .hpd_enable directly instead of from a work item.
drm_bridge_hpd_enable() has already released hpd_mutex when it calls
.hpd_enable (only hpd_state_mutex is held), so drm_bridge_hpd_notify()
can be called there, and there is no work item to cancel on unbind.
That leaves the stale status. A mutex in drm_aux_hpd_bridge_data, held
around storing and notifying in drm_aux_hpd_bridge_notify() and around
reading and notifying in .hpd_enable, closes it. Roughly (plus
devm_mutex_init() and the initial unknown status in probe):

struct drm_aux_hpd_bridge_data {
struct drm_bridge bridge;
struct device *dev;
+ struct mutex lock;
+ enum drm_connector_status status;
};
@@ drm_aux_hpd_bridge_notify()
if (!data)
return;

+ guard(mutex)(&data->lock);
+ data->status = status;
drm_bridge_hpd_notify(&data->bridge, status);
}
@@
+static void drm_aux_hpd_bridge_hpd_enable(struct drm_bridge *bridge)
+{
+ struct drm_aux_hpd_bridge_data *data =
+ container_of(bridge, struct drm_aux_hpd_bridge_data, bridge);
+
+ guard(mutex)(&data->lock);
+ if (data->status != connector_status_unknown)
+ drm_bridge_hpd_notify(bridge, data->status);
+}

With the mutex, the monitor was detected in 2 of 2 boots, and 2
replugs and 2 s2idle cycles still worked. An earlier version without
the mutex was detected in 4 of 4 boots.

Dmitry's "drm/bridge: aux-hpd: let drivers pass IRQ_HPD events"
changes drm_aux_hpd_bridge_notify(), so v2 may need to go on top of it:
https://lore.kernel.org/all/20261024-hpd-irq-events-v8-5-6ee949e7a384@xxxxxxxxxxxxxxxx/

I can test v2.

Thanks,
Joonhoe Kim