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()
241 static void timeout_release_mlock(struct host1x_cdma *cdma) in timeout_release_mlock() argument
252 struct host1x_channel *ch = cdma_to_channel(cdma); in timeout_release_mlock()
253 struct host1x *host1x = cdma_to_host1x(cdma); in timeout_release_mlock()
280 struct host1x_cdma *cdma; in cdma_timeout_handler() local
284 cdma = container_of(to_delayed_work(work), struct host1x_cdma, in cdma_timeout_handler()
286 host1x = cdma_to_host1x(cdma); in cdma_timeout_handler()
287 ch = cdma_to_channel(cdma); in cdma_timeout_handler()
289 host1x_debug_dump(cdma_to_host1x(cdma)); in cdma_timeout_handler()
291 mutex_lock(&cdma->lock); in cdma_timeout_handler()
293 if (!cdma->timeout.client) { in cdma_timeout_handler()
296 mutex_unlock(&cdma->lock); in cdma_timeout_handler()
303 syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt); in cdma_timeout_handler()
306 if ((s32)(syncpt_val - cdma->timeout.syncpt_val) >= 0) { in cdma_timeout_handler()
311 mutex_unlock(&cdma->lock); in cdma_timeout_handler()
316 __func__, cdma->timeout.syncpt->id, cdma->timeout.syncpt->name, in cdma_timeout_handler()
317 syncpt_val, cdma->timeout.syncpt_val); in cdma_timeout_handler()
320 host1x_hw_cdma_freeze(host1x, cdma); in cdma_timeout_handler()
323 timeout_release_mlock(cdma); in cdma_timeout_handler()
325 host1x_cdma_update_sync_queue(cdma, ch->dev); in cdma_timeout_handler()
326 mutex_unlock(&cdma->lock); in cdma_timeout_handler()
332 static int cdma_timeout_init(struct host1x_cdma *cdma) in cdma_timeout_init() argument
334 INIT_DELAYED_WORK(&cdma->timeout.wq, cdma_timeout_handler); in cdma_timeout_init()
335 cdma->timeout.initialized = true; in cdma_timeout_init()
343 static void cdma_timeout_destroy(struct host1x_cdma *cdma) in cdma_timeout_destroy() argument
345 if (cdma->timeout.initialized) in cdma_timeout_destroy()
346 cancel_delayed_work(&cdma->timeout.wq); in cdma_timeout_destroy()
348 cdma->timeout.initialized = false; in cdma_timeout_destroy()