Skip to content

Commit 8223a60

Browse files
Timur Kristófalexdeucher
authored andcommitted
drm/amd/display: Refactor amdgpu_dm_connector_detect (v2)
Prepare for polling analog connectors. Document the function better. Signed-off-by: Timur Kristóf <timur.kristof@gmail.com> Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent e45d60a commit 8223a60

1 file changed

Lines changed: 19 additions & 16 deletions

File tree

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7226,29 +7226,32 @@ create_stream_for_sink(struct drm_connector *connector,
72267226
return stream;
72277227
}
72287228

7229+
/**
7230+
* amdgpu_dm_connector_detect() - Detect whether a DRM connector is connected to a display
7231+
*
7232+
* A connector is considered connected when it has a sink that is not NULL.
7233+
* For connectors that support HPD (hotplug detection), the connection is
7234+
* handled in the HPD interrupt.
7235+
*
7236+
* Notes:
7237+
* 1. This interface is NOT called in context of HPD irq.
7238+
* 2. This interface *is called* in context of user-mode ioctl. Which
7239+
* makes it a bad place for *any* MST-related activity.
7240+
*/
72297241
static enum drm_connector_status
72307242
amdgpu_dm_connector_detect(struct drm_connector *connector, bool force)
72317243
{
7232-
bool connected;
72337244
struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
72347245

7235-
/*
7236-
* Notes:
7237-
* 1. This interface is NOT called in context of HPD irq.
7238-
* 2. This interface *is called* in context of user-mode ioctl. Which
7239-
* makes it a bad place for *any* MST-related activity.
7240-
*/
7241-
7242-
if (aconnector->base.force == DRM_FORCE_UNSPECIFIED &&
7243-
!aconnector->fake_enable)
7244-
connected = (aconnector->dc_sink != NULL);
7245-
else
7246-
connected = (aconnector->base.force == DRM_FORCE_ON ||
7247-
aconnector->base.force == DRM_FORCE_ON_DIGITAL);
7248-
72497246
update_subconnector_property(aconnector);
72507247

7251-
return (connected ? connector_status_connected :
7248+
if (aconnector->base.force == DRM_FORCE_ON ||
7249+
aconnector->base.force == DRM_FORCE_ON_DIGITAL)
7250+
return connector_status_connected;
7251+
else if (aconnector->base.force == DRM_FORCE_OFF)
7252+
return connector_status_disconnected;
7253+
7254+
return (aconnector->dc_sink ? connector_status_connected :
72527255
connector_status_disconnected);
72537256
}
72547257

0 commit comments

Comments
 (0)