drm/amd/display: Read AUX channel even if only status byte is returned
authorLeo (Sunpeng) Li <sunpeng.li@amd.com>
Tue, 26 Jun 2018 14:50:16 +0000 (10:50 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 13 Jul 2018 19:50:52 +0000 (14:50 -0500)
[Why]
get_channel_status() can return 0 in returned_bytes, and report a
successful operation result. This is because it prunes the first status
byte out. This was preventing read_channel_reply() from being called
(due to the faulty condition), and consequently preventing the AUX
reply status from being set.

[How]
Fix the conditional so that it accounts for when get_channel_status()
returns 0 bytes read.

[Fixes]
Fixes possible edid read failures during S3 resume, where we are now
relying on DRM's DP AUX handling. This was an regression introduced by:

    Author: Harry Wentland <harry.wentland@amd.com>
        drm/amd/display: Return aux replies directly to DRM

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c

index d108ccfc5cf9fb5e60b38a947347980bb72759a3..08c9d73b9ab727776f337540ed32b388d5e700a4 100644 (file)
@@ -671,7 +671,7 @@ int dc_link_aux_transfer(struct ddc_service *ddc,
        case AUX_CHANNEL_OPERATION_SUCCEEDED:
                res = returned_bytes;
 
-               if (res <= size && res > 0)
+               if (res <= size && res >= 0)
                        res = engine->funcs->read_channel_reply(engine, size,
                                                                buffer, reply,
                                                                &status);