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 <[email protected]>
---
Changelog:
v2:
- removed pm_runtime_mark_last_busy(), as it is not included in
pm_runtime_put_autosuspend()
v1:
https://lore.kernel.org/all/[email protected]/
---
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