diff options
author | Rob Clark <robdclark@gmail.com> | 2014-01-12 01:11:59 +0400 |
---|---|---|
committer | Rob Clark <robdclark@gmail.com> | 2014-03-31 18:27:45 +0400 |
commit | 0963756fe51313a1e2d76885cd21624d3b2cfbf2 (patch) | |
tree | ddb5bdc7770c2a386bfdf78f0463d8e1c228c9f4 /drivers/gpu/drm/msm/adreno/adreno_gpu.h | |
parent | 5b6ef08e4b4e1bcb6b3ac4172c054e4462e2c767 (diff) | |
download | linux-0963756fe51313a1e2d76885cd21624d3b2cfbf2.tar.xz |
drm/msm: spin helper
Helper macro to simplify places where we need to poll with timeout
waiting for gpu.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/msm/adreno/adreno_gpu.h')
-rw-r--r-- | drivers/gpu/drm/msm/adreno/adreno_gpu.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.h b/drivers/gpu/drm/msm/adreno/adreno_gpu.h index e16200ddc60b..63c36ce33020 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.h +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.h @@ -76,7 +76,20 @@ struct adreno_platform_config { #endif }; -#define ADRENO_IDLE_TIMEOUT (20 * 1000) +#define ADRENO_IDLE_TIMEOUT msecs_to_jiffies(1000) + +#define spin_until(X) ({ \ + int __ret = -ETIMEDOUT; \ + unsigned long __t = jiffies + ADRENO_IDLE_TIMEOUT; \ + do { \ + if (X) { \ + __ret = 0; \ + break; \ + } \ + } while (time_before(jiffies, __t)); \ + __ret; \ +}) + static inline bool adreno_is_a3xx(struct adreno_gpu *gpu) { |