Skip to contentSkip to conversation

drm/amdgpu: Clear HDMI audio descriptors for sinks without audio

PATCH New [email protected] 1 participant 1 message Nov 9

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Clear HDMI audio descriptors for sinks without audio

From: Wang Jiang <[email protected]>

EDID without SAD left stale AZ descriptors; emulated ATI ELD faked audio capability. Clear them.

The legacy implementation refers to ce9778b7a027, "ALSA: hda/hdmi: Consider ELD invalid when no SAD is present".

---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 7 ++++++-
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c  | 7 ++++++-
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c  | 6 +++++-
 3 files changed, 17 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +6 -1
index f2977fe6d824..f967ee505271 100644
@@ -1341,8 +1341,13 @@ static void dce_v10_0_audio_write_sad_regs(struct drm_encoder *encoder)
 	sad_count = drm_edid_to_sad(drm_edid_raw(amdgpu_connector->edid), &sads);
 	if (sad_count < 0)
 		DRM_ERROR("Couldn't read SADs: %d\n", sad_count);
-	if (sad_count <= 0)
+	if (sad_count <= 0) {
+		/* sink has no audio capability: clear stale descriptors */
+		for (i = 0; i < ARRAY_SIZE(eld_reg_to_type); i++)
+			WREG32_AUDIO_ENDPT(dig->afmt->pin->offset,
+					   eld_reg_to_type[i][0], 0);
 		return;
+	}
 	BUG_ON(!sads);
 
 	for (i = 0; i < ARRAY_SIZE(eld_reg_to_type); i++) {
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +6 -1
index c68de0fe1d7d..18c171c533de 100644
@@ -1320,8 +1320,13 @@ static void dce_v6_0_audio_write_sad_regs(struct drm_encoder *encoder)
 	sad_count = drm_edid_to_sad(drm_edid_raw(amdgpu_connector->edid), &sads);
 	if (sad_count < 0)
 		DRM_ERROR("Couldn't read SADs: %d\n", sad_count);
-	if (sad_count <= 0)
+	if (sad_count <= 0) {
+		/* sink has no audio capability: clear stale descriptors */
+		for (i = 0; i < ARRAY_SIZE(eld_reg_to_type); i++)
+			WREG32_AUDIO_ENDPT(dig->afmt->pin->offset,
+					   eld_reg_to_type[i][0], 0);
 		return;
+	}
 
 	for (i = 0; i < ARRAY_SIZE(eld_reg_to_type); i++) {
 		u32 value = 0;
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +5 -1
index c3906270f25e..62922736d569 100644
@@ -1313,8 +1313,12 @@ static void dce_v8_0_audio_write_sad_regs(struct drm_encoder *encoder)
 	sad_count = drm_edid_to_sad(drm_edid_raw(amdgpu_connector->edid), &sads);
 	if (sad_count < 0)
 		DRM_ERROR("Couldn't read SADs: %d\n", sad_count);
-	if (sad_count <= 0)
+	if (sad_count <= 0) {
+		/* sink has no audio capability: clear stale descriptors */
+		for (i = 0; i < ARRAY_SIZE(eld_reg_to_type); i++)
+			WREG32_AUDIO_ENDPT(offset, eld_reg_to_type[i][0], 0);
 		return;
+	}
 	BUG_ON(!sads);
 
 	for (i = 0; i < ARRAY_SIZE(eld_reg_to_type); i++) {
Signature · 1 line
2.25.1