Commit 8223a605 authored by Timur Kristóf's avatar Timur Kristóf Committed by Alex Deucher
Browse files

drm/amd/display: Refactor amdgpu_dm_connector_detect (v2)



Prepare for polling analog connectors.
Document the function better.

Signed-off-by: default avatarTimur Kristóf <timur.kristof@gmail.com>
Reviewed-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent e45d60a7
Loading
Loading
Loading
Loading
+19 −16
Original line number Diff line number Diff line
@@ -7226,29 +7226,32 @@ create_stream_for_sink(struct drm_connector *connector,
	return stream;
}

static enum drm_connector_status
amdgpu_dm_connector_detect(struct drm_connector *connector, bool force)
{
	bool connected;
	struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);

	/*
/**
 * amdgpu_dm_connector_detect() - Detect whether a DRM connector is connected to a display
 *
 * A connector is considered connected when it has a sink that is not NULL.
 * For connectors that support HPD (hotplug detection), the connection is
 * handled in the HPD interrupt.
 *
 * Notes:
 * 1. This interface is NOT called in context of HPD irq.
 * 2. This interface *is called* in context of user-mode ioctl. Which
 *    makes it a bad place for *any* MST-related activity.
 */

	if (aconnector->base.force == DRM_FORCE_UNSPECIFIED &&
	    !aconnector->fake_enable)
		connected = (aconnector->dc_sink != NULL);
	else
		connected = (aconnector->base.force == DRM_FORCE_ON ||
				aconnector->base.force == DRM_FORCE_ON_DIGITAL);
static enum drm_connector_status
amdgpu_dm_connector_detect(struct drm_connector *connector, bool force)
{
	struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);

	update_subconnector_property(aconnector);

	return (connected ? connector_status_connected :
	if (aconnector->base.force == DRM_FORCE_ON ||
		aconnector->base.force == DRM_FORCE_ON_DIGITAL)
		return connector_status_connected;
	else if (aconnector->base.force == DRM_FORCE_OFF)
		return connector_status_disconnected;

	return (aconnector->dc_sink ? connector_status_connected :
			connector_status_disconnected);
}