* [PATCH v2] drm/bridge: analogix_dp: Hold runtime PM reference in bridge detect [not found] <CGME20261119103751eucas1p16485be9bf23e31909f3b2df7c1c9d43f@eucas1p1.samsung.com> @ 2026-11-19 10:37 ` Marek Szyprowski 2026-11-19 18:14 ` Brian Norris 0 siblings, 1 reply; 2+ messages in thread From: Marek Szyprowski @ 2026-11-19 10:37 UTC (permalink / raw) To: dri-devel Cc: Marek Szyprowski, Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, Damon Ding, Dmitry Baryshkov, Heiko Stuebner, Douglas Anderson, Brian Norris analogix_dp_bridge_detect() calls analogix_dp_detect_hpd() without holding a runtime PM reference on the DP device. If there is no HPD GPIO, analogix_dp_get_plug_in_status() reads ANALOGIX_DP_SYS_CTL_3 and, with "force-hpd", analogix_dp_force_hpd() also writes to it. When the display is disabled the controller is runtime suspended, so these are accesses to an unclocked (and possibly unpowered) IP block. The connector created by drm_bridge_connector is polled because the bridge provides DRM_BRIDGE_OP_DETECT without DRM_BRIDGE_OP_HPD, and userspace may also query the connector state at any time, so this path is regularly executed with the device suspended. It affects only setups without a next bridge or panel (e.g. a DP connector), as otherwise detect returns early. Take a runtime PM reference around the HPD check, the same way as analogix_dpaux_transfer() and analogix_dpaux_wait_hpd_asserted() do, and report the connector status as unknown if the device cannot be resumed. Fixes: 2b77a2918c5d ("drm: bridge: analogix/dp: move hpd detect to connector detect function") Closes: https://sashiko.dev/#/bug/linux-ea09d64b-12cd-4301-bd54-12c515b01bde Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> --- Changelog: v2: - removed pm_runtime_mark_last_busy(), as it is not included in pm_runtime_put_autosuspend() v1: https://lore.kernel.org/all/20261119092857.1158971-1-m.szyprowski@samsung.com/ --- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 84951413012b..664ee46c8e53 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -905,9 +905,14 @@ analogix_dp_bridge_detect(struct drm_bridge *bridge, struct drm_connector *conne if (dp->plat_data->next_bridge) return connector_status_connected; + if (pm_runtime_resume_and_get(dp->dev) < 0) + return connector_status_unknown; + if (!analogix_dp_detect_hpd(dp)) status = connector_status_connected; + pm_runtime_put_autosuspend(dp->dev); + return status; } -- 2.43.0 ^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] drm/bridge: analogix_dp: Hold runtime PM reference in bridge detect 2026-11-19 10:37 ` [PATCH v2] drm/bridge: analogix_dp: Hold runtime PM reference in bridge detect Marek Szyprowski @ 2026-11-19 18:14 ` Brian Norris 0 siblings, 0 replies; 2+ messages in thread From: Brian Norris @ 2026-11-19 18:14 UTC (permalink / raw) To: Marek Szyprowski Cc: dri-devel, Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, Damon Ding, Dmitry Baryshkov, Heiko Stuebner, Douglas Anderson On Thu, Nov 19, 2026 at 11:37:41AM +0100, Marek Szyprowski wrote: > analogix_dp_bridge_detect() calls analogix_dp_detect_hpd() without > holding a runtime PM reference on the DP device. If there is no HPD > GPIO, analogix_dp_get_plug_in_status() reads ANALOGIX_DP_SYS_CTL_3 and, > with "force-hpd", analogix_dp_force_hpd() also writes to it. When the > display is disabled the controller is runtime suspended, so these are > accesses to an unclocked (and possibly unpowered) IP block. If there *is* an HPD GPIO and no 'force-hpd' ... is this patch wasteful? How much? (Honest question. I don't remember all the details here, but you're suggesting this can be poked by userspace any time, so it seems like it might be relevant.) Brian > The connector created by drm_bridge_connector is polled because the > bridge provides DRM_BRIDGE_OP_DETECT without DRM_BRIDGE_OP_HPD, and > userspace may also query the connector state at any time, so this path > is regularly executed with the device suspended. It affects only setups > without a next bridge or panel (e.g. a DP connector), as otherwise > detect returns early. > > Take a runtime PM reference around the HPD check, the same way as > analogix_dpaux_transfer() and analogix_dpaux_wait_hpd_asserted() do, > and report the connector status as unknown if the device cannot be > resumed. > > Fixes: 2b77a2918c5d ("drm: bridge: analogix/dp: move hpd detect to connector detect function") > Closes: https://sashiko.dev/#/bug/linux-ea09d64b-12cd-4301-bd54-12c515b01bde > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> > --- > Changelog: > v2: > - removed pm_runtime_mark_last_busy(), as it is not included in > pm_runtime_put_autosuspend() > > v1: https://lore.kernel.org/all/20261119092857.1158971-1-m.szyprowski@samsung.com/ > --- > drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c > index 84951413012b..664ee46c8e53 100644 > --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c > +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c > @@ -905,9 +905,14 @@ analogix_dp_bridge_detect(struct drm_bridge *bridge, struct drm_connector *conne > if (dp->plat_data->next_bridge) > return connector_status_connected; > > + if (pm_runtime_resume_and_get(dp->dev) < 0) > + return connector_status_unknown; > + > if (!analogix_dp_detect_hpd(dp)) > status = connector_status_connected; > > + pm_runtime_put_autosuspend(dp->dev); > + > return status; > } > > -- > 2.43.0 > ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-19 18:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20261119103751eucas1p16485be9bf23e31909f3b2df7c1c9d43f@eucas1p1.samsung.com>
2026-11-19 10:37 ` [PATCH v2] drm/bridge: analogix_dp: Hold runtime PM reference in bridge detect Marek Szyprowski
2026-11-19 18:14 ` Brian Norris
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox