summaryrefslogtreecommitdiff
path: root/include/drm
diff options
context:
space:
mode:
authorCristian Ciocaltea <cristian.ciocaltea@collabora.com>2026-09-01 21:50:30 +0300
committerCristian Ciocaltea <cristian.ciocaltea@collabora.com>2026-09-19 23:03:44 +0300
commit9d1e2ae7196dacc90acc00a73b92c11662eb90ca (patch)
tree85d57f1d4bc07b81ad503b63005622da985c9dc2 /include/drm
parentcc6d8b2f87b97477ae25dcc1adb8e6e5a0088e4a (diff)
downloadlinux-next-9d1e2ae7196dacc90acc00a73b92c11662eb90ca.tar.gz
linux-next-9d1e2ae7196dacc90acc00a73b92c11662eb90ca.zip
drm/probe-helper: Introduce .force_ctx() connector callback
The .force() connector callback is invoked by drm_helper_probe_single_connector_modes() while the modeset acquire context it created is live, but the hook signature provides no way to pass it down, e.g. to support implementations needing to lock further objects. Add a .force_ctx() variant to drm_connector_helper_funcs, taking the acquire context and returning an error code, so that -EDEADLK propagates into the existing retry path. When provided, it takes precedence over drm_connector_funcs' .force(), which is kept for existing users. This is a prerequisite for SCDC status synchronization in the HDMI connector framework. Reviewed-by: Maxime Ripard <mripard@kernel.org> Link: https://patch.msgid.link/20260901-dw-hdmi-qp-scramb-v11-6-bc12954a0688@collabora.com Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/drm_connector.h6
-rw-r--r--include/drm/drm_modeset_helper_vtables.h28
2 files changed, 34 insertions, 0 deletions
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index be51265e8e26..f2be06f12b1a 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -1670,6 +1670,12 @@ struct drm_connector_funcs {
* the sysfs interfaces or on the kernel cmdline. In that case the
* @detect callback isn't called.
*
+ * New drivers should implement
+ * &drm_connector_helper_funcs.force_ctx instead, which gets passed
+ * the modeset acquire context and thus allows taking additional
+ * locks. It takes precedence over this callback when both are
+ * implemented.
+ *
* FIXME:
*
* Note that this hook is only called by the probe helper. It's not in
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
index dc4c5e8733c3..60b30cc26940 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -936,6 +936,34 @@ struct drm_connector_helper_funcs {
bool force);
/**
+ * @force_ctx:
+ *
+ * This function is called to update internal encoder state when the
+ * connector is forced to a certain state by userspace, either through
+ * the sysfs interfaces or on the kernel cmdline. In that case the
+ * @detect_ctx callback isn't called.
+ *
+ * This is the atomic version of &drm_connector_funcs.force. When
+ * both are implemented, this one takes precedence and
+ * &drm_connector_funcs.force is not called.
+ *
+ * To avoid races against concurrent connector state updates, the
+ * helper libraries always call this with ctx set to a valid context,
+ * and &drm_mode_config.connection_mutex will always be locked with
+ * the ctx parameter set to this ctx. This allows taking additional
+ * locks as required.
+ *
+ * RETURNS:
+ *
+ * Zero on success, or a negative error code otherwise. This includes
+ * -EDEADLK when a lock acquisition needs to be restarted, in which
+ * case the helpers take care of backing off and calling this function
+ * again.
+ */
+ int (*force_ctx)(struct drm_connector *connector,
+ struct drm_modeset_acquire_ctx *ctx);
+
+ /**
* @mode_valid:
*
* Callback to validate a mode for a connector, irrespective of the