summaryrefslogtreecommitdiff
path: root/drivers/video/tegra/host/nvhost_syncpt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/tegra/host/nvhost_syncpt.c')
-rw-r--r--drivers/video/tegra/host/nvhost_syncpt.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/video/tegra/host/nvhost_syncpt.c b/drivers/video/tegra/host/nvhost_syncpt.c
index 84dfc5c3af83..11e793f4d6f1 100644
--- a/drivers/video/tegra/host/nvhost_syncpt.c
+++ b/drivers/video/tegra/host/nvhost_syncpt.c
@@ -161,17 +161,23 @@ void nvhost_syncpt_incr(struct nvhost_syncpt *sp, u32 id)
* Main entrypoint for syncpoint value waits.
*/
int nvhost_syncpt_wait_timeout(struct nvhost_syncpt *sp, u32 id,
- u32 thresh, u32 timeout)
+ u32 thresh, u32 timeout, u32 *value)
{
DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wq);
void *ref;
int err = 0;
+ if (value)
+ *value = 0;
+
BUG_ON(!check_max(sp, id, thresh));
/* first check cache */
- if (nvhost_syncpt_min_cmp(sp, id, thresh))
+ if (nvhost_syncpt_min_cmp(sp, id, thresh)) {
+ if (value)
+ *value = nvhost_syncpt_read_min(sp, id);
return 0;
+ }
/* keep host alive */
nvhost_module_busy(&syncpt_to_dev(sp)->mod);
@@ -179,8 +185,11 @@ int nvhost_syncpt_wait_timeout(struct nvhost_syncpt *sp, u32 id,
if (client_managed(id) || !nvhost_syncpt_min_eq_max(sp, id)) {
/* try to read from register */
u32 val = nvhost_syncpt_update_min(sp, id);
- if ((s32)(val - thresh) >= 0)
+ if ((s32)(val - thresh) >= 0) {
+ if (value)
+ *value = val;
goto done;
+ }
}
if (!timeout) {
@@ -202,6 +211,8 @@ int nvhost_syncpt_wait_timeout(struct nvhost_syncpt *sp, u32 id,
nvhost_syncpt_min_cmp(sp, id, thresh),
check);
if (remain > 0 || nvhost_syncpt_min_cmp(sp, id, thresh)) {
+ if (value)
+ *value = nvhost_syncpt_read_min(sp, id);
err = 0;
break;
}