]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
drm: xilinx: dp: Retry the aux transaction when it fails
authorHyun Kwon <hyun.kwon@xilinx.com>
Wed, 29 Mar 2017 20:32:17 +0000 (13:32 -0700)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 30 Mar 2017 10:41:27 +0000 (12:41 +0200)
Retry the aux transaction up to 128 times. Per spec, it needs to
try at least 3 times, but there's some monitor (Viewsonic VX2880ml)
which requires 64 retries. Try up to 128 times to be safe.
Other monitors are more likely to succeed for the first try, so this
patch doesn't hurt other monitors.

Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/gpu/drm/xilinx/xilinx_drm_dp.c

index eeed0c500311f1bc1017de38f96a2548c590289e..952d8cd35e65ac4c2aad1b3ba97ed4f9a1741d83 100644 (file)
@@ -1229,13 +1229,21 @@ xilinx_drm_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
 {
        struct xilinx_drm_dp *dp = container_of(aux, struct xilinx_drm_dp, aux);
        int ret;
+       unsigned int i;
 
-       ret = xilinx_drm_dp_aux_cmd_submit(dp, msg->request, msg->address,
-                                          msg->buffer, msg->size, &msg->reply);
-       if (ret < 0)
-               return ret;
+       for (i = 0; i < 128; i++) {
+               ret = xilinx_drm_dp_aux_cmd_submit(dp, msg->request,
+                                                  msg->address, msg->buffer,
+                                                  msg->size, &msg->reply);
+               if (!ret)
+                       return msg->size;
 
-       return msg->size;
+               usleep_range(400, 500);
+       }
+
+       dev_dbg(dp->dev, "failed to do aux transfer (%d)\n", ret);
+
+       return ret;
 }
 
 static int xilinx_drm_dp_parse_of(struct xilinx_drm_dp *dp)