drm/amd/display: make aux defer delay and aux sw start delay seperate
authorXiaodong Yan <Xiaodong.Yan@amd.com>
Fri, 30 Aug 2019 09:07:01 +0000 (17:07 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 11 Oct 2019 00:34:06 +0000 (19:34 -0500)
[why]
1. defer delay and sw start delay has been mixed up, defer delay was
programmed to AUX_SW_CONTROL:AUX_SW_START_DELAY.
2. There's no delay for defer

[how]
1. Set  aux sw start to 0
2. Add delay for defer scenario

Signed-off-by: Xiaodong Yan <Xiaodong.Yan@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dce/dce_aux.c

index c3f9f41..48a0e4a 100644 (file)
@@ -475,7 +475,7 @@ int dce_aux_transfer_raw(struct ddc_service *ddc,
        aux_req.action = i2caux_action_from_payload(payload);
 
        aux_req.address = payload->address;
-       aux_req.delay = payload->defer_delay * 10;
+       aux_req.delay = 0;
        aux_req.length = payload->length;
        aux_req.data = payload->data;
 
@@ -544,8 +544,15 @@ bool dce_aux_transfer_with_retries(struct ddc_service *ddc,
                        case AUX_TRANSACTION_REPLY_AUX_DEFER:
                        case AUX_TRANSACTION_REPLY_I2C_OVER_AUX_NACK:
                        case AUX_TRANSACTION_REPLY_I2C_OVER_AUX_DEFER:
-                               if (++aux_defer_retries >= AUX_MAX_DEFER_RETRIES)
+                               if (++aux_defer_retries >= AUX_MAX_DEFER_RETRIES) {
                                        goto fail;
+                               } else {
+                                       if ((*payload->reply == AUX_TRANSACTION_REPLY_AUX_DEFER) ||
+                                               (*payload->reply == AUX_TRANSACTION_REPLY_I2C_OVER_AUX_DEFER)) {
+                                               if (payload->defer_delay > 0)
+                                                       msleep(payload->defer_delay);
+                                       }
+                               }
                                break;
 
                        case AUX_TRANSACTION_REPLY_I2C_DEFER: