Lines Matching refs:cdma

12 #include "../cdma.h"
28 static void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr,
34 host1x_syncpt_incr(cdma->timeout.syncpt);
37 host1x_syncpt_load(cdma->timeout.syncpt);
43 static void cdma_start(struct host1x_cdma *cdma)
45 struct host1x_channel *ch = cdma_to_channel(cdma);
48 if (cdma->running)
51 cdma->last_pos = cdma->push_buffer.pos;
52 start = cdma->push_buffer.dma;
53 end = cdma->push_buffer.size + 4;
63 host1x_ch_writel(ch, cdma->push_buffer.pos, HOST1X_CHANNEL_DMAPUT);
81 cdma->running = true;
89 static void cdma_timeout_restart(struct host1x_cdma *cdma, u32 getptr)
91 struct host1x *host1x = cdma_to_host1x(cdma);
92 struct host1x_channel *ch = cdma_to_channel(cdma);
95 if (cdma->running)
98 cdma->last_pos = cdma->push_buffer.pos;
103 start = cdma->push_buffer.dma;
104 end = cdma->push_buffer.size + 4;
127 cdma->last_pos);
132 host1x_ch_writel(ch, cdma->push_buffer.pos, HOST1X_CHANNEL_DMAPUT);
137 cdma->running = true;
143 static void cdma_flush(struct host1x_cdma *cdma)
145 struct host1x_channel *ch = cdma_to_channel(cdma);
147 if (cdma->push_buffer.pos != cdma->last_pos) {
148 host1x_ch_writel(ch, cdma->push_buffer.pos,
150 cdma->last_pos = cdma->push_buffer.pos;
154 static void cdma_stop(struct host1x_cdma *cdma)
156 struct host1x_channel *ch = cdma_to_channel(cdma);
158 mutex_lock(&cdma->lock);
160 if (cdma->running) {
161 host1x_cdma_wait_locked(cdma, CDMA_EVENT_SYNC_QUEUE_EMPTY);
164 cdma->running = false;
167 mutex_unlock(&cdma->lock);
198 static void cdma_freeze(struct host1x_cdma *cdma)
200 struct host1x *host = cdma_to_host1x(cdma);
201 struct host1x_channel *ch = cdma_to_channel(cdma);
203 if (cdma->torndown && !cdma->running) {
215 cdma->last_pos);
222 cdma->running = false;
223 cdma->torndown = true;
226 static void cdma_resume(struct host1x_cdma *cdma, u32 getptr)
228 struct host1x *host1x = cdma_to_host1x(cdma);
229 struct host1x_channel *ch = cdma_to_channel(cdma);
237 cdma->torndown = false;
238 cdma_timeout_restart(cdma, getptr);
241 static void timeout_release_mlock(struct host1x_cdma *cdma)
252 struct host1x_channel *ch = cdma_to_channel(cdma);
253 struct host1x *host1x = cdma_to_host1x(cdma);
280 struct host1x_cdma *cdma;
284 cdma = container_of(to_delayed_work(work), struct host1x_cdma,
286 host1x = cdma_to_host1x(cdma);
287 ch = cdma_to_channel(cdma);
289 host1x_debug_dump(cdma_to_host1x(cdma));
291 mutex_lock(&cdma->lock);
293 if (!cdma->timeout.client) {
296 mutex_unlock(&cdma->lock);
303 syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt);
306 if ((s32)(syncpt_val - cdma->timeout.syncpt_val) >= 0) {
311 mutex_unlock(&cdma->lock);
316 __func__, cdma->timeout.syncpt->id, cdma->timeout.syncpt->name,
317 syncpt_val, cdma->timeout.syncpt_val);
320 host1x_hw_cdma_freeze(host1x, cdma);
323 timeout_release_mlock(cdma);
325 host1x_cdma_update_sync_queue(cdma, ch->dev);
326 mutex_unlock(&cdma->lock);
332 static int cdma_timeout_init(struct host1x_cdma *cdma)
334 INIT_DELAYED_WORK(&cdma->timeout.wq, cdma_timeout_handler);
335 cdma->timeout.initialized = true;
343 static void cdma_timeout_destroy(struct host1x_cdma *cdma)
345 if (cdma->timeout.initialized)
346 cancel_delayed_work(&cdma->timeout.wq);
348 cdma->timeout.initialized = false;