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);
249 struct host1x_cdma *cdma;
253 cdma = container_of(to_delayed_work(work), struct host1x_cdma,
255 host1x = cdma_to_host1x(cdma);
256 ch = cdma_to_channel(cdma);
258 host1x_debug_dump(cdma_to_host1x(cdma));
260 mutex_lock(&cdma->lock);
262 if (!cdma->timeout.client) {
265 mutex_unlock(&cdma->lock);
272 syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt);
275 if ((s32)(syncpt_val - cdma->timeout.syncpt_val) >= 0) {
280 mutex_unlock(&cdma->lock);
285 __func__, cdma->timeout.syncpt->id, cdma->timeout.syncpt->name,
286 syncpt_val, cdma->timeout.syncpt_val);
289 host1x_hw_cdma_freeze(host1x, cdma);
291 host1x_cdma_update_sync_queue(cdma, ch->dev);
292 mutex_unlock(&cdma->lock);
298 static int cdma_timeout_init(struct host1x_cdma *cdma, unsigned int syncpt)
300 INIT_DELAYED_WORK(&cdma->timeout.wq, cdma_timeout_handler);
301 cdma->timeout.initialized = true;
309 static void cdma_timeout_destroy(struct host1x_cdma *cdma)
311 if (cdma->timeout.initialized)
312 cancel_delayed_work(&cdma->timeout.wq);
314 cdma->timeout.initialized = false;