drm/amd: be quiet when no SAD block is found
authorJean Delvare <jdelvare@suse.de>
Wed, 4 Sep 2019 09:12:48 +0000 (11:12 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 16 Sep 2019 15:42:56 +0000 (10:42 -0500)
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

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
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>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c

index 645550e7caf5183cf193bb4fb8afaf04a7d02405..f7aaa3fa5c95e92da58d5257596cda7b6b02ddc7 100644 (file)
@@ -1352,10 +1352,10 @@ static void dce_v10_0_audio_write_sad_regs(struct drm_encoder *encoder)
        }
 
        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++) {
index d9f470632b2ca1682a7c64c8004e2eb9a33a1849..ed1021b4af3cf47dfca9c889644bca49f8094ea2 100644 (file)
@@ -1378,10 +1378,10 @@ static void dce_v11_0_audio_write_sad_regs(struct drm_encoder *encoder)
        }
 
        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++) {
index 3eb2e74292697325c7539efea0755b2970494115..59774bc8adf3ce0e702c2578e054e9b31c58b24a 100644 (file)
@@ -1257,10 +1257,10 @@ static void dce_v6_0_audio_write_sad_regs(struct drm_encoder *encoder)
        }
 
        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;
index a16c5e9e610e766ebd55c3f90b3ab68df0e96dcf..fba00c08f3e771ee360d4db9d749f9837f1c7ab0 100644 (file)
@@ -1305,10 +1305,10 @@ static void dce_v8_0_audio_write_sad_regs(struct drm_encoder *encoder)
        }
 
        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++) {
index d0118405733fdd03614ac4bd7f6fdeeb8df962b3..11e5784aa62a15cc2d66b0270c9d7dda99e2e2a8 100644 (file)
@@ -97,11 +97,10 @@ enum dc_edid_status dm_helpers_parse_edid_caps(
                        (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) {