Re: [PATCH v3] drm/msm/dp: hold one runtime PM reference per plugged state
From: Dmitry Baryshkov
Date: Wed Nov 11 2026 - 12:17:06 EST
On Sat, Oct 24, 2026 at 02:19:52PM +0900, Joonhoe Kim wrote:
> msm_dp_bridge_detect() takes a runtime PM reference and keeps it when
> it leaves the sink plugged, so that the plugged state keeps the
> controller on. If the sink was plugged already, the plugged state holds
> a reference, and the new one is leaked. If the sink was plugged and
> detect() finds it gone, it drops only its own reference and clears the
> plugged state, so the unplug handler skips the put and the plugged
> state's reference is leaked as well.
>
> detect() runs on every probe of the connector. When HPD comes from a
> later bridge, such as a USB-C connector, nothing else keeps the
> controller on, and the leaked references keep it and the MDSS core GDSC
> powered after the display is unplugged.
>
> Hold the function's own reference for the duration of the call, take
> the plugged state's reference when detect() sets the plugged state and
> drop it when detect() clears it.
>
> Fixes: 3ea2d1c3d154 ("drm/msm/dp: turn link_ready into plugged")
> Signed-off-by: Joonhoe Kim <26rote@xxxxxxxxx>
> ---
> Depends on patch 6/9 of the IRQ_HPD series v8 [1], which stops the
> plug handler from taking extra references; only detect() is left here.
> Dmitry, feel free to fold this into that series if you prefer.
>
> Tested on v7.3 with 6/9 of [1] and this patch on a Lenovo Y700 Gen 5
> (TB323FU) with a USB-C display: booting with the display connected,
> plug, unplug, quick replug and s2idle. The controller suspends after
> unplug.
>
> Changes in v3:
> - Rebase on [1] and drop the plug handler part
> - Hold detect()'s own reference with PM_RUNTIME_ACQUIRE_IF_ENABLED()
> and take or drop the plugged state's reference only when detect()
> changes the plugged state [Val]
> - detect() now drops its last reference with pm_runtime_put() instead
> of pm_runtime_put_sync()
> - Link to v2: https://lore.kernel.org/all/20261007155848.106-1-26rote@xxxxxxxxx/
>
> [1] https://lore.kernel.org/all/20261024-hpd-irq-events-v8-0-6ee949e7a384@xxxxxxxxxxxxxxxx/
>
> drivers/gpu/drm/msm/dp/dp_display.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxxxxxxxx>
--
With best wishes
Dmitry