Lines Matching refs:cdma

28 static void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr,  in cdma_timeout_cpu_incr()  argument
34 host1x_syncpt_incr(cdma->timeout.syncpt); in cdma_timeout_cpu_incr()
37 host1x_syncpt_load(cdma->timeout.syncpt); in cdma_timeout_cpu_incr()
43 static void cdma_start(struct host1x_cdma *cdma) in cdma_start() argument
45 struct host1x_channel *ch = cdma_to_channel(cdma); in cdma_start()
48 if (cdma->running) in cdma_start()
51 cdma->last_pos = cdma->push_buffer.pos; in cdma_start()
52 start = cdma->push_buffer.dma; in cdma_start()
53 end = cdma->push_buffer.size + 4; in cdma_start()
63 host1x_ch_writel(ch, cdma->push_buffer.pos, HOST1X_CHANNEL_DMAPUT); in cdma_start()
81 cdma->running = true; in cdma_start()
89 static void cdma_timeout_restart(struct host1x_cdma *cdma, u32 getptr) in cdma_timeout_restart() argument
91 struct host1x *host1x = cdma_to_host1x(cdma); in cdma_timeout_restart()
92 struct host1x_channel *ch = cdma_to_channel(cdma); in cdma_timeout_restart()
95 if (cdma->running) in cdma_timeout_restart()
98 cdma->last_pos = cdma->push_buffer.pos; in cdma_timeout_restart()
103 start = cdma->push_buffer.dma; in cdma_timeout_restart()
104 end = cdma->push_buffer.size + 4; in cdma_timeout_restart()
127 cdma->last_pos); in cdma_timeout_restart()
132 host1x_ch_writel(ch, cdma->push_buffer.pos, HOST1X_CHANNEL_DMAPUT); in cdma_timeout_restart()
137 cdma->running = true; in cdma_timeout_restart()
143 static void cdma_flush(struct host1x_cdma *cdma) in cdma_flush() argument
145 struct host1x_channel *ch = cdma_to_channel(cdma); in cdma_flush()
147 if (cdma->push_buffer.pos != cdma->last_pos) { in cdma_flush()
148 host1x_ch_writel(ch, cdma->push_buffer.pos, in cdma_flush()
150 cdma->last_pos = cdma->push_buffer.pos; in cdma_flush()
154 static void cdma_stop(struct host1x_cdma *cdma) in cdma_stop() argument
156 struct host1x_channel *ch = cdma_to_channel(cdma); in cdma_stop()
158 mutex_lock(&cdma->lock); in cdma_stop()
160 if (cdma->running) { in cdma_stop()
161 host1x_cdma_wait_locked(cdma, CDMA_EVENT_SYNC_QUEUE_EMPTY); in cdma_stop()
164 cdma->running = false; in cdma_stop()
167 mutex_unlock(&cdma->lock); in cdma_stop()
198 static void cdma_freeze(struct host1x_cdma *cdma) in cdma_freeze() argument
200 struct host1x *host = cdma_to_host1x(cdma); in cdma_freeze()
201 struct host1x_channel *ch = cdma_to_channel(cdma); in cdma_freeze()
203 if (cdma->torndown && !cdma->running) { in cdma_freeze()
215 cdma->last_pos); in cdma_freeze()
222 cdma->running = false; in cdma_freeze()
223 cdma->torndown = true; in cdma_freeze()
226 static void cdma_resume(struct host1x_cdma *cdma, u32 getptr) in cdma_resume() argument
228 struct host1x *host1x = cdma_to_host1x(cdma); in cdma_resume()
229 struct host1x_channel *ch = cdma_to_channel(cdma); in cdma_resume()
237 cdma->torndown = false; in cdma_resume()
238 cdma_timeout_restart(cdma, getptr); in cdma_resume()
249 struct host1x_cdma *cdma; in cdma_timeout_handler() local
253 cdma = container_of(to_delayed_work(work), struct host1x_cdma, in cdma_timeout_handler()
255 host1x = cdma_to_host1x(cdma); in cdma_timeout_handler()
256 ch = cdma_to_channel(cdma); in cdma_timeout_handler()
258 host1x_debug_dump(cdma_to_host1x(cdma)); in cdma_timeout_handler()
260 mutex_lock(&cdma->lock); in cdma_timeout_handler()
262 if (!cdma->timeout.client) { in cdma_timeout_handler()
265 mutex_unlock(&cdma->lock); in cdma_timeout_handler()
272 syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt); in cdma_timeout_handler()
275 if ((s32)(syncpt_val - cdma->timeout.syncpt_val) >= 0) { in cdma_timeout_handler()
280 mutex_unlock(&cdma->lock); in cdma_timeout_handler()
285 __func__, cdma->timeout.syncpt->id, cdma->timeout.syncpt->name, in cdma_timeout_handler()
286 syncpt_val, cdma->timeout.syncpt_val); in cdma_timeout_handler()
289 host1x_hw_cdma_freeze(host1x, cdma); in cdma_timeout_handler()
291 host1x_cdma_update_sync_queue(cdma, ch->dev); in cdma_timeout_handler()
292 mutex_unlock(&cdma->lock); in cdma_timeout_handler()
298 static int cdma_timeout_init(struct host1x_cdma *cdma) in cdma_timeout_init() argument
300 INIT_DELAYED_WORK(&cdma->timeout.wq, cdma_timeout_handler); in cdma_timeout_init()
301 cdma->timeout.initialized = true; in cdma_timeout_init()
309 static void cdma_timeout_destroy(struct host1x_cdma *cdma) in cdma_timeout_destroy() argument
311 if (cdma->timeout.initialized) in cdma_timeout_destroy()
312 cancel_delayed_work(&cdma->timeout.wq); in cdma_timeout_destroy()
314 cdma->timeout.initialized = false; in cdma_timeout_destroy()