Lines Matching refs:cdma
39 static void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr, in cdma_timeout_cpu_incr() argument
42 struct host1x *host1x = cdma_to_host1x(cdma); in cdma_timeout_cpu_incr()
43 struct push_buffer *pb = &cdma->push_buffer; in cdma_timeout_cpu_incr()
47 host1x_syncpt_incr(cdma->timeout.syncpt); in cdma_timeout_cpu_incr()
50 host1x_syncpt_load(cdma->timeout.syncpt); in cdma_timeout_cpu_incr()
68 static void cdma_start(struct host1x_cdma *cdma) in cdma_start() argument
70 struct host1x_channel *ch = cdma_to_channel(cdma); in cdma_start()
72 if (cdma->running) in cdma_start()
75 cdma->last_pos = cdma->push_buffer.pos; in cdma_start()
81 host1x_ch_writel(ch, cdma->push_buffer.dma, HOST1X_CHANNEL_DMASTART); in cdma_start()
82 host1x_ch_writel(ch, cdma->push_buffer.pos, HOST1X_CHANNEL_DMAPUT); in cdma_start()
83 host1x_ch_writel(ch, cdma->push_buffer.dma + cdma->push_buffer.size + 4, in cdma_start()
95 cdma->running = true; in cdma_start()
103 static void cdma_timeout_restart(struct host1x_cdma *cdma, u32 getptr) in cdma_timeout_restart() argument
105 struct host1x *host1x = cdma_to_host1x(cdma); in cdma_timeout_restart()
106 struct host1x_channel *ch = cdma_to_channel(cdma); in cdma_timeout_restart()
108 if (cdma->running) in cdma_timeout_restart()
111 cdma->last_pos = cdma->push_buffer.pos; in cdma_timeout_restart()
117 host1x_ch_writel(ch, cdma->push_buffer.dma, HOST1X_CHANNEL_DMASTART); in cdma_timeout_restart()
118 host1x_ch_writel(ch, cdma->push_buffer.dma + cdma->push_buffer.size, in cdma_timeout_restart()
132 cdma->last_pos); in cdma_timeout_restart()
137 host1x_ch_writel(ch, cdma->push_buffer.pos, HOST1X_CHANNEL_DMAPUT); in cdma_timeout_restart()
142 cdma->running = true; in cdma_timeout_restart()
148 static void cdma_flush(struct host1x_cdma *cdma) in cdma_flush() argument
150 struct host1x_channel *ch = cdma_to_channel(cdma); in cdma_flush()
152 if (cdma->push_buffer.pos != cdma->last_pos) { in cdma_flush()
153 host1x_ch_writel(ch, cdma->push_buffer.pos, in cdma_flush()
155 cdma->last_pos = cdma->push_buffer.pos; in cdma_flush()
159 static void cdma_stop(struct host1x_cdma *cdma) in cdma_stop() argument
161 struct host1x_channel *ch = cdma_to_channel(cdma); in cdma_stop()
163 mutex_lock(&cdma->lock); in cdma_stop()
165 if (cdma->running) { in cdma_stop()
166 host1x_cdma_wait_locked(cdma, CDMA_EVENT_SYNC_QUEUE_EMPTY); in cdma_stop()
169 cdma->running = false; in cdma_stop()
172 mutex_unlock(&cdma->lock); in cdma_stop()
203 static void cdma_freeze(struct host1x_cdma *cdma) in cdma_freeze() argument
205 struct host1x *host = cdma_to_host1x(cdma); in cdma_freeze()
206 struct host1x_channel *ch = cdma_to_channel(cdma); in cdma_freeze()
208 if (cdma->torndown && !cdma->running) { in cdma_freeze()
220 cdma->last_pos); in cdma_freeze()
227 cdma->running = false; in cdma_freeze()
228 cdma->torndown = true; in cdma_freeze()
231 static void cdma_resume(struct host1x_cdma *cdma, u32 getptr) in cdma_resume() argument
233 struct host1x *host1x = cdma_to_host1x(cdma); in cdma_resume()
234 struct host1x_channel *ch = cdma_to_channel(cdma); in cdma_resume()
242 cdma->torndown = false; in cdma_resume()
243 cdma_timeout_restart(cdma, getptr); in cdma_resume()
254 struct host1x_cdma *cdma; in cdma_timeout_handler() local
258 cdma = container_of(to_delayed_work(work), struct host1x_cdma, in cdma_timeout_handler()
260 host1x = cdma_to_host1x(cdma); in cdma_timeout_handler()
261 ch = cdma_to_channel(cdma); in cdma_timeout_handler()
263 host1x_debug_dump(cdma_to_host1x(cdma)); in cdma_timeout_handler()
265 mutex_lock(&cdma->lock); in cdma_timeout_handler()
267 if (!cdma->timeout.client) { in cdma_timeout_handler()
270 mutex_unlock(&cdma->lock); in cdma_timeout_handler()
277 syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt); in cdma_timeout_handler()
280 if ((s32)(syncpt_val - cdma->timeout.syncpt_val) >= 0) { in cdma_timeout_handler()
285 mutex_unlock(&cdma->lock); in cdma_timeout_handler()
290 __func__, cdma->timeout.syncpt->id, cdma->timeout.syncpt->name, in cdma_timeout_handler()
291 syncpt_val, cdma->timeout.syncpt_val); in cdma_timeout_handler()
294 host1x_hw_cdma_freeze(host1x, cdma); in cdma_timeout_handler()
296 host1x_cdma_update_sync_queue(cdma, ch->dev); in cdma_timeout_handler()
297 mutex_unlock(&cdma->lock); in cdma_timeout_handler()
303 static int cdma_timeout_init(struct host1x_cdma *cdma, unsigned int syncpt) in cdma_timeout_init() argument
305 INIT_DELAYED_WORK(&cdma->timeout.wq, cdma_timeout_handler); in cdma_timeout_init()
306 cdma->timeout.initialized = true; in cdma_timeout_init()
314 static void cdma_timeout_destroy(struct host1x_cdma *cdma) in cdma_timeout_destroy() argument
316 if (cdma->timeout.initialized) in cdma_timeout_destroy()
317 cancel_delayed_work(&cdma->timeout.wq); in cdma_timeout_destroy()
319 cdma->timeout.initialized = false; in cdma_timeout_destroy()