Hi,
On 2024/3/21 22:09, Maxime Ripard wrote:
Hi,
On Wed, Mar 20, 2024 at 10:34:17AM +0100, Thomas Zimmermann wrote:
+/**
+ * drm_connector_helper_detect_ctx - Read EDID and detect connector status.
+ * @connector: The connector
+ * @ctx: Acquire context
+ * @force: Perform screen-destructive operations, if necessary
+ *
+ * Detects the connector status by reading the EDID using drm_probe_ddc(),
+ * which requires connector->ddc to be set. Returns connector_status_connected
+ * on success or connector_status_disconnected on failure.
+ *
+ * Returns:
+ * The connector status as defined by enum drm_connector_status.
+ */
+int drm_connector_helper_detect_ctx(struct drm_connector *connector,
+ struct drm_modeset_acquire_ctx *ctx,
+ bool force)
+{
+ struct i2c_adapter *ddc = connector->ddc;
+
+ if (!ddc)
+ return connector_status_unknown;
+
+ if (drm_probe_ddc(ddc))
+ return connector_status_connected;
+
+ return connector_status_disconnected;
+}
+EXPORT_SYMBOL(drm_connector_helper_detect_ctx);
I think it would be better to make it more obvious that we rely on DDC
to detect and we shouldn't consider it a generic helper that would work
in all cases.
drm_connector_helper_detect_probe_ddc maybe?
Yeah, the function name(drm_connector_helper_detect_ctx) is a little bit of casual.
So a better name is preferred.
Maxime
--
Best regards,
Sui