summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCristian Ciocaltea <cristian.ciocaltea@collabora.com>2026-10-05 03:38:06 +0300
committerHeiko Stuebner <heiko@sntech.de>2026-10-12 18:01:49 +0200
commita58efc1aa0bb67abe1946be72a1c67d17d78aadf (patch)
treedb8552d8fe843acb030abfd29c8bf489ba5545fa /include
parent046dbe428a69e0e2a8d09ac7de75ebc9bd469a46 (diff)
downloadlinux-a58efc1aa0bb67abe1946be72a1c67d17d78aadf.tar.gz
linux-a58efc1aa0bb67abe1946be72a1c67d17d78aadf.zip
drm/bridge: dw-hdmi-qp: Provide dw_hdmi_qp_hpd_notify() helper
Export dw_hdmi_qp_hpd_notify() for platform drivers to report hot-plug detection events. Unlike drm_helper_hpd_irq_event() which polls all connectors, this helper targets only the affected connector and ensures .detect_ctx() is invoked on reconnection events to trigger SCDC state recovery. Track the connector in use in curr_conn, set and cleared by the atomic enable/disable hooks. Since the helper runs asynchronously from IRQ/work context, hold a reference on that connector for as long as the bridge is enabled, so that the pointer is always safe to dereference. Otherwise validity would rest on the platform glue quiescing HPD before the DRM-managed connector is freed during teardown, risking a use-after-free on a late HPD event. The helper must take its own temporary reference while running, because the long-lived reference above only guarantees the pointer is valid at the time it is read, not that the connector survives a concurrent atomic_disable dropping that reference while the helper is still using it. Moreover, reading the pointer and acquiring the temporary reference must be atomic with respect to atomic_disable, otherwise a window exists where drm_connector_get() is called on a connector whose refcount already reached zero, hence guard curr_conn with a mutex for this purpose. Holding the mutex across the whole helper instead is not an option, as it takes modeset locks while atomic_disable is called with them held. Also note that this helper may sleep, so it must only be called from a threaded HPD interrupt handler or a work function. Tested-by: Maud Spierings <maud_spierings@hotmail.com> Tested-by: Diederik de Haas <diederik@cknow-tech.com> # NanoPC-T6 LTS, Rock 5B Tested-by: Robin Räber <robin.raebi@gmail.com> Tested-by: Igor Paunovic <royalnet026@gmail.com> # RK3588 Orange Pi 5 Plus, dual HDMI Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Signed-off-by: Heiko Stuebner <heiko@sntech.de> Link: https://patch.msgid.link/20261005-dw-hdmi-qp-scramb-v12-5-195157ba0b40@collabora.com
Diffstat (limited to 'include')
-rw-r--r--include/drm/bridge/dw_hdmi_qp.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/drm/bridge/dw_hdmi_qp.h b/include/drm/bridge/dw_hdmi_qp.h
index b80fceffc315..b4fb1c578a5b 100644
--- a/include/drm/bridge/dw_hdmi_qp.h
+++ b/include/drm/bridge/dw_hdmi_qp.h
@@ -36,6 +36,7 @@ struct dw_hdmi_qp_plat_data {
struct dw_hdmi_qp *dw_hdmi_qp_bind(struct platform_device *pdev,
struct drm_encoder *encoder,
const struct dw_hdmi_qp_plat_data *plat_data);
+void dw_hdmi_qp_hpd_notify(struct dw_hdmi_qp *hdmi);
void dw_hdmi_qp_suspend(struct device *dev, struct dw_hdmi_qp *hdmi);
void dw_hdmi_qp_resume(struct device *dev, struct dw_hdmi_qp *hdmi);
#endif /* __DW_HDMI_QP__ */