drm/amd/display: Always notify the HDA driver on connector disconnect

amdgpu_dm_audio_eld_notify() is currently only called in atomic commits.
This results in the state of the HDA driver never getting updated when
an audio sink is removed and an atomic commit never comes. (eg the HDMI
audio jack switch in ALSA stays 'on' after the HDMI cable is
disconnected if no other display is connected to cause the compositor to
submit an atomic commit)

Call amdgpu_dm_audio_eld_notify() in
amdgpu_dm_update_connector_after_detect() when a sink is no longer
available to ensure that the HDA driver always gets notified on
disconnect regardless of atomic commits.

Assisted-by: Copilot:claude-sonnet-4.6
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Reviewed-by: George Zhang <george.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Nícolas F. R. A. Prado
2026-06-26 10:18:06 -04:00
committed by Alex Deucher
parent c119d05a36
commit faad8105e9
3 changed files with 11 additions and 2 deletions

View File

@@ -182,7 +182,7 @@ void amdgpu_dm_audio_fini(struct amdgpu_device *adev)
}
EXPORT_IF_KUNIT(amdgpu_dm_audio_fini);
STATIC_IFN_KUNIT void amdgpu_dm_audio_eld_notify(struct amdgpu_device *adev, int pin)
void amdgpu_dm_audio_eld_notify(struct amdgpu_device *adev, int pin)
{
struct drm_audio_component *acomp = adev->dm.audio_component;

View File

@@ -40,6 +40,7 @@ void amdgpu_dm_commit_audio(struct drm_device *dev,
void amdgpu_dm_fill_audio_info(struct audio_info *audio_info,
const struct drm_connector *drm_connector,
const struct dc_sink *dc_sink);
void amdgpu_dm_audio_eld_notify(struct amdgpu_device *adev, int pin);
#if IS_ENABLED(CONFIG_DRM_AMD_DC_KUNIT_TEST)
struct device;
@@ -48,7 +49,6 @@ int amdgpu_dm_audio_component_bind(struct device *kdev,
struct device *hda_kdev, void *data);
void amdgpu_dm_audio_component_unbind(struct device *kdev,
struct device *hda_kdev, void *data);
void amdgpu_dm_audio_eld_notify(struct amdgpu_device *adev, int pin);
int amdgpu_dm_audio_get_param(void);
void amdgpu_dm_audio_set_param(int val);
void amdgpu_dm_audio_init_pins(struct amdgpu_device *adev, int audio_count,

View File

@@ -500,6 +500,8 @@ void amdgpu_dm_update_connector_after_detect(
struct drm_connector *connector = &aconnector->base;
struct dc_sink *sink __free(sink_release) = NULL;
struct drm_device *dev = connector->dev;
struct amdgpu_device *adev = drm_to_adev(dev);
int inst;
/* MST handled by drm_mst framework */
if (aconnector->mst_mgr.mst_state)
@@ -638,6 +640,13 @@ void amdgpu_dm_update_connector_after_detect(
/* Set CP to DESIRED if it was ENABLED, so we can re-enable it again on hotplug */
if (connector->state->content_protection == DRM_MODE_CONTENT_PROTECTION_ENABLED)
connector->state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;
mutex_lock(&adev->dm.audio_lock);
inst = aconnector->audio_inst;
aconnector->audio_inst = -1;
mutex_unlock(&adev->dm.audio_lock);
if (inst != -1)
amdgpu_dm_audio_eld_notify(adev, inst);
}
update_subconnector_property(aconnector);