[1/3] drm/amd: be quiet when no SAD block is found

Submitted by Jean Delvare on Aug. 30, 2019, 4:15 p.m.

Details

Message ID 20190830181503.5dd2ed81@endymion
State New
Headers show
Series "drm/edid: don't log errors on absent CEA SAD blocks" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Jean Delvare Aug. 30, 2019, 4:15 p.m.
It is fine for displays without audio functionality to not provide
any SAD block in their EDID. Do not log an error in that case,
just return quietly.

This fixes half of bug fdo#107825:
https://bugs.freedesktop.org/show_bug.cgi?id=107825

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian K├Ânig" <christian.koenig@amd.com>
Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Leo Li <sunpeng.li@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c                    |    4 ++--
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c                    |    4 ++--
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c                     |    4 ++--
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c                     |    4 ++--
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c |    7 +++----
 5 files changed, 11 insertions(+), 12 deletions(-)

Patch hide | download patch | download mbox

--- linux-5.2.orig/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c	2019-07-08 00:41:56.000000000 +0200
+++ linux-5.2/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c	2019-08-30 14:28:46.081682223 +0200
@@ -1345,10 +1345,10 @@  static void dce_v10_0_audio_write_sad_re
 	}
 
 	sad_count = drm_edid_to_sad(amdgpu_connector_edid(connector), &sads);
-	if (sad_count <= 0) {
+	if (sad_count < 0)
 		DRM_ERROR("Couldn't read SADs: %d\n", sad_count);
+	if (sad_count <= 0)
 		return;
-	}
 	BUG_ON(!sads);
 
 	for (i = 0; i < ARRAY_SIZE(eld_reg_to_type); i++) {
--- linux-5.2.orig/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c	2019-07-08 00:41:56.000000000 +0200
+++ linux-5.2/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c	2019-08-30 14:29:27.276205310 +0200
@@ -1371,10 +1371,10 @@  static void dce_v11_0_audio_write_sad_re
 	}
 
 	sad_count = drm_edid_to_sad(amdgpu_connector_edid(connector), &sads);
-	if (sad_count <= 0) {
+	if (sad_count < 0)
 		DRM_ERROR("Couldn't read SADs: %d\n", sad_count);
+	if (sad_count <= 0)
 		return;
-	}
 	BUG_ON(!sads);
 
 	for (i = 0; i < ARRAY_SIZE(eld_reg_to_type); i++) {
--- linux-5.2.orig/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c	2019-07-08 00:41:56.000000000 +0200
+++ linux-5.2/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c	2019-08-30 17:58:53.613953458 +0200
@@ -1248,10 +1248,10 @@  static void dce_v6_0_audio_write_sad_reg
 	}
 
 	sad_count = drm_edid_to_sad(amdgpu_connector_edid(connector), &sads);
-	if (sad_count <= 0) {
+	if (sad_count < 0)
 		DRM_ERROR("Couldn't read SADs: %d\n", sad_count);
+	if (sad_count <= 0)
 		return;
-	}
 
 	for (i = 0; i < ARRAY_SIZE(eld_reg_to_type); i++) {
 		u32 tmp = 0;
--- linux-5.2.orig/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c	2019-07-08 00:41:56.000000000 +0200
+++ linux-5.2/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c	2019-08-30 14:29:01.948883708 +0200
@@ -1298,10 +1298,10 @@  static void dce_v8_0_audio_write_sad_reg
 	}
 
 	sad_count = drm_edid_to_sad(amdgpu_connector_edid(connector), &sads);
-	if (sad_count <= 0) {
+	if (sad_count < 0)
 		DRM_ERROR("Couldn't read SADs: %d\n", sad_count);
+	if (sad_count <= 0)
 		return;
-	}
 	BUG_ON(!sads);
 
 	for (i = 0; i < ARRAY_SIZE(eld_reg_to_type); i++) {
--- linux-5.2.orig/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c	2019-07-08 00:41:56.000000000 +0200
+++ linux-5.2/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c	2019-08-30 14:31:03.086421910 +0200
@@ -98,11 +98,10 @@  enum dc_edid_status dm_helpers_parse_edi
 			(struct edid *) edid->raw_edid);
 
 	sad_count = drm_edid_to_sad((struct edid *) edid->raw_edid, &sads);
-	if (sad_count <= 0) {
-		DRM_INFO("SADs count is: %d, don't need to read it\n",
-				sad_count);
+	if (sad_count < 0)
+		DRM_ERROR("Couldn't read SADs: %d\n", sad_count);
+	if (sad_count <= 0)
 		return result;
-	}
 
 	edid_caps->audio_mode_count = sad_count < DC_MAX_AUDIO_DESC_COUNT ? sad_count : DC_MAX_AUDIO_DESC_COUNT;
 	for (i = 0; i < edid_caps->audio_mode_count; ++i) {