summaryrefslogtreecommitdiff
path: root/drivers/gpu/host1x/syncpt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/host1x/syncpt.c')
-rw-r--r--drivers/gpu/host1x/syncpt.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/gpu/host1x/syncpt.c b/drivers/gpu/host1x/syncpt.c
index acc7d82e0585..807c74fc6a0a 100644
--- a/drivers/gpu/host1x/syncpt.c
+++ b/drivers/gpu/host1x/syncpt.c
@@ -222,11 +222,12 @@ int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout,
{
struct dma_fence *fence;
long wait_err;
+ u32 curr;
- host1x_hw_syncpt_load(sp->host, sp);
+ curr = host1x_syncpt_load(sp);
if (value)
- *value = host1x_syncpt_load(sp);
+ *value = curr;
if (host1x_syncpt_is_expired(sp, thresh))
return 0;
@@ -245,21 +246,25 @@ int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout,
host1x_fence_cancel(fence);
dma_fence_put(fence);
- if (value)
- *value = host1x_syncpt_load(sp);
-
/*
* Don't rely on dma_fence_wait_timeout return value,
* since it returns zero both on timeout and if the
* wait completed with 0 jiffies left.
*/
- host1x_hw_syncpt_load(sp->host, sp);
- if (wait_err == 0 && !host1x_syncpt_is_expired(sp, thresh))
+ if (wait_err == 0 && !host1x_syncpt_is_expired(sp, thresh)) {
+ if (value)
+ *value = host1x_syncpt_load(sp);
+
return -EAGAIN;
- else if (wait_err < 0)
+ } else if (wait_err < 0) {
return wait_err;
- else
+ } else {
+ /* Success, read the value cached by ISR */
+ if (value)
+ *value = host1x_syncpt_read_min(sp);
+
return 0;
+ }
}
EXPORT_SYMBOL(host1x_syncpt_wait);