* Re: [PATCH] drm/bridge: aux-hpd-bridge: replay last HPD status on hpd_enable
[not found] <20260803-drm-usbdp-preboot-v1-1-2539b362be00@oss.qualcomm.com>
@ 2026-11-07 2:12 ` Joonhoe Kim
2026-11-29 23:29 ` Joonhoe Kim
0 siblings, 1 reply; 2+ messages in thread
From: Joonhoe Kim @ 2026-11-07 2:12 UTC (permalink / raw)
To: Yongxing Mou
Cc: Luca Ceresoli, Dmitry Baryshkov, Andrzej Hajda, Neil Armstrong,
Robert Foss, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, dri-devel, linux-arm-msm, linux-kernel
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@oss.qualcomm.com/
I can test v2.
Thanks,
Joonhoe Kim
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/bridge: aux-hpd-bridge: replay last HPD status on hpd_enable
2026-11-07 2:12 ` [PATCH] drm/bridge: aux-hpd-bridge: replay last HPD status on hpd_enable Joonhoe Kim
@ 2026-11-29 23:29 ` Joonhoe Kim
0 siblings, 0 replies; 2+ messages in thread
From: Joonhoe Kim @ 2026-11-29 23:29 UTC (permalink / raw)
To: Yongxing Mou
Cc: Luca Ceresoli, Dmitry Baryshkov, Andrzej Hajda, Neil Armstrong,
Robert Foss, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, dri-devel, linux-arm-msm, linux-kernel
On Sat, Nov 07, 2026 at 11:12:16AM +0900, Joonhoe Kim wrote:
> On the two Sashiko points: I tested a variant that replays the status
> from .hpd_enable directly instead of from a work item.
Please disregard that variant. On resume, msm re-enables HPD from its PM
complete callback, so a direct replay runs the DP driver's HPD handling
there, before tasks are thawed. After a DP unplug during s2idle that
pmic_glink_altmode did not report (fix sent in [1]), the replayed
"connected" status made the DP driver read the DPCD of the missing sink
over AUX, which held up resume for 33 s on the Lenovo Y700 Gen 5. That
is longer than its 30 s hardware watchdog, which reset the system in
one run. Even with [1], the resume right after the unplug still replays
"connected", because the altmode notification arrives only after tasks
are thawed; that resume took 3.5 s.
With your work item the replay runs in a kworker, so it should not hold
up resume, although I have not tested that. If the system suspends
again while the work is still retrying AUX, cancel_work_sync() in
.hpd_disable waits for it from the PM prepare callback. The lock from my
earlier mail still applies there: holding it in the work function
around reading the status and notifying closes the stale-status race.
The work also still needs to be cancelled on unbind.
[1] https://lore.kernel.org/all/20261129232915.468-1-26rote@gmail.com/
Thanks,
Joonhoe Kim
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-29 23:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260803-drm-usbdp-preboot-v1-1-2539b362be00@oss.qualcomm.com>
2026-11-07 2:12 ` [PATCH] drm/bridge: aux-hpd-bridge: replay last HPD status on hpd_enable Joonhoe Kim
2026-11-29 23:29 ` Joonhoe Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox