diff options
Diffstat (limited to 'drivers/gpu/host1x/syncpt.h')
-rw-r--r-- | drivers/gpu/host1x/syncpt.h | 46 |
1 files changed, 7 insertions, 39 deletions
diff --git a/drivers/gpu/host1x/syncpt.h b/drivers/gpu/host1x/syncpt.h index 267c0b9d3647..9056465ecd3f 100644 --- a/drivers/gpu/host1x/syncpt.h +++ b/drivers/gpu/host1x/syncpt.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #define __HOST1X_SYNCPT_H | 20 | #define __HOST1X_SYNCPT_H |
21 | 21 | ||
22 | #include <linux/atomic.h> | 22 | #include <linux/atomic.h> |
23 | #include <linux/host1x.h> | ||
23 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
24 | #include <linux/sched.h> | 25 | #include <linux/sched.h> |
25 | 26 | ||
@@ -30,6 +31,11 @@ struct host1x; | |||
30 | /* Reserved for replacing an expired wait with a NOP */ | 31 | /* Reserved for replacing an expired wait with a NOP */ |
31 | #define HOST1X_SYNCPT_RESERVED 0 | 32 | #define HOST1X_SYNCPT_RESERVED 0 |
32 | 33 | ||
34 | struct host1x_syncpt_base { | ||
35 | unsigned int id; | ||
36 | bool requested; | ||
37 | }; | ||
38 | |||
33 | struct host1x_syncpt { | 39 | struct host1x_syncpt { |
34 | int id; | 40 | int id; |
35 | atomic_t min_val; | 41 | atomic_t min_val; |
@@ -39,6 +45,7 @@ struct host1x_syncpt { | |||
39 | bool client_managed; | 45 | bool client_managed; |
40 | struct host1x *host; | 46 | struct host1x *host; |
41 | struct device *dev; | 47 | struct device *dev; |
48 | struct host1x_syncpt_base *base; | ||
42 | 49 | ||
43 | /* interrupt data */ | 50 | /* interrupt data */ |
44 | struct host1x_syncpt_intr intr; | 51 | struct host1x_syncpt_intr intr; |
@@ -50,25 +57,6 @@ int host1x_syncpt_init(struct host1x *host); | |||
50 | /* Free sync point array */ | 57 | /* Free sync point array */ |
51 | void host1x_syncpt_deinit(struct host1x *host); | 58 | void host1x_syncpt_deinit(struct host1x *host); |
52 | 59 | ||
53 | /* | ||
54 | * Read max. It indicates how many operations there are in queue, either in | ||
55 | * channel or in a software thread. | ||
56 | * */ | ||
57 | static inline u32 host1x_syncpt_read_max(struct host1x_syncpt *sp) | ||
58 | { | ||
59 | smp_rmb(); | ||
60 | return (u32)atomic_read(&sp->max_val); | ||
61 | } | ||
62 | |||
63 | /* | ||
64 | * Read min, which is a shadow of the current sync point value in hardware. | ||
65 | */ | ||
66 | static inline u32 host1x_syncpt_read_min(struct host1x_syncpt *sp) | ||
67 | { | ||
68 | smp_rmb(); | ||
69 | return (u32)atomic_read(&sp->min_val); | ||
70 | } | ||
71 | |||
72 | /* Return number of sync point supported. */ | 60 | /* Return number of sync point supported. */ |
73 | int host1x_syncpt_nb_pts(struct host1x *host); | 61 | int host1x_syncpt_nb_pts(struct host1x *host); |
74 | 62 | ||
@@ -112,9 +100,6 @@ static inline bool host1x_syncpt_idle(struct host1x_syncpt *sp) | |||
112 | return (min == max); | 100 | return (min == max); |
113 | } | 101 | } |
114 | 102 | ||
115 | /* Return pointer to struct denoting sync point id. */ | ||
116 | struct host1x_syncpt *host1x_syncpt_get(struct host1x *host, u32 id); | ||
117 | |||
118 | /* Load current value from hardware to the shadow register. */ | 103 | /* Load current value from hardware to the shadow register. */ |
119 | u32 host1x_syncpt_load(struct host1x_syncpt *sp); | 104 | u32 host1x_syncpt_load(struct host1x_syncpt *sp); |
120 | 105 | ||
@@ -130,16 +115,9 @@ void host1x_syncpt_restore(struct host1x *host); | |||
130 | /* Read current wait base value into shadow register and return it. */ | 115 | /* Read current wait base value into shadow register and return it. */ |
131 | u32 host1x_syncpt_load_wait_base(struct host1x_syncpt *sp); | 116 | u32 host1x_syncpt_load_wait_base(struct host1x_syncpt *sp); |
132 | 117 | ||
133 | /* Request incrementing a sync point. */ | ||
134 | int host1x_syncpt_incr(struct host1x_syncpt *sp); | ||
135 | |||
136 | /* Indicate future operations by incrementing the sync point max. */ | 118 | /* Indicate future operations by incrementing the sync point max. */ |
137 | u32 host1x_syncpt_incr_max(struct host1x_syncpt *sp, u32 incrs); | 119 | u32 host1x_syncpt_incr_max(struct host1x_syncpt *sp, u32 incrs); |
138 | 120 | ||
139 | /* Wait until sync point reaches a threshold value, or a timeout. */ | ||
140 | int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, | ||
141 | long timeout, u32 *value); | ||
142 | |||
143 | /* Check if sync point id is valid. */ | 121 | /* Check if sync point id is valid. */ |
144 | static inline int host1x_syncpt_is_valid(struct host1x_syncpt *sp) | 122 | static inline int host1x_syncpt_is_valid(struct host1x_syncpt *sp) |
145 | { | 123 | { |
@@ -149,14 +127,4 @@ static inline int host1x_syncpt_is_valid(struct host1x_syncpt *sp) | |||
149 | /* Patch a wait by replacing it with a wait for syncpt 0 value 0 */ | 127 | /* Patch a wait by replacing it with a wait for syncpt 0 value 0 */ |
150 | int host1x_syncpt_patch_wait(struct host1x_syncpt *sp, void *patch_addr); | 128 | int host1x_syncpt_patch_wait(struct host1x_syncpt *sp, void *patch_addr); |
151 | 129 | ||
152 | /* Return id of the sync point */ | ||
153 | u32 host1x_syncpt_id(struct host1x_syncpt *sp); | ||
154 | |||
155 | /* Allocate a sync point for a device. */ | ||
156 | struct host1x_syncpt *host1x_syncpt_request(struct device *dev, | ||
157 | bool client_managed); | ||
158 | |||
159 | /* Free a sync point. */ | ||
160 | void host1x_syncpt_free(struct host1x_syncpt *sp); | ||
161 | |||
162 | #endif | 130 | #endif |