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()
67 static void cdma_start(struct host1x_cdma *cdma) in cdma_start() argument
69 struct host1x_channel *ch = cdma_to_channel(cdma); in cdma_start()
71 if (cdma->running) in cdma_start()
74 cdma->last_pos = cdma->push_buffer.pos; in cdma_start()
80 host1x_ch_writel(ch, cdma->push_buffer.phys, HOST1X_CHANNEL_DMASTART); in cdma_start()
81 host1x_ch_writel(ch, cdma->push_buffer.pos, HOST1X_CHANNEL_DMAPUT); in cdma_start()
82 host1x_ch_writel(ch, cdma->push_buffer.phys + in cdma_start()
83 cdma->push_buffer.size_bytes + 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.phys, HOST1X_CHANNEL_DMASTART); in cdma_timeout_restart()
118 host1x_ch_writel(ch, cdma->push_buffer.phys + in cdma_timeout_restart()
119 cdma->push_buffer.size_bytes, in cdma_timeout_restart()
133 cdma->last_pos); in cdma_timeout_restart()
138 host1x_ch_writel(ch, cdma->push_buffer.pos, HOST1X_CHANNEL_DMAPUT); in cdma_timeout_restart()
143 cdma->running = true; in cdma_timeout_restart()
149 static void cdma_flush(struct host1x_cdma *cdma) in cdma_flush() argument
151 struct host1x_channel *ch = cdma_to_channel(cdma); in cdma_flush()
153 if (cdma->push_buffer.pos != cdma->last_pos) { in cdma_flush()
154 host1x_ch_writel(ch, cdma->push_buffer.pos, in cdma_flush()
156 cdma->last_pos = cdma->push_buffer.pos; in cdma_flush()
160 static void cdma_stop(struct host1x_cdma *cdma) in cdma_stop() argument
162 struct host1x_channel *ch = cdma_to_channel(cdma); in cdma_stop()
164 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()
171 mutex_unlock(&cdma->lock); in cdma_stop()
178 static void cdma_freeze(struct host1x_cdma *cdma) in cdma_freeze() argument
180 struct host1x *host = cdma_to_host1x(cdma); in cdma_freeze()
181 struct host1x_channel *ch = cdma_to_channel(cdma); in cdma_freeze()
184 if (cdma->torndown && !cdma->running) { in cdma_freeze()
198 cdma->last_pos); in cdma_freeze()
205 cdma->running = false; in cdma_freeze()
206 cdma->torndown = true; in cdma_freeze()
209 static void cdma_resume(struct host1x_cdma *cdma, u32 getptr) in cdma_resume() argument
211 struct host1x *host1x = cdma_to_host1x(cdma); in cdma_resume()
212 struct host1x_channel *ch = cdma_to_channel(cdma); in cdma_resume()
223 cdma->torndown = false; in cdma_resume()
224 cdma_timeout_restart(cdma, getptr); in cdma_resume()
234 struct host1x_cdma *cdma; in cdma_timeout_handler() local
242 cdma = container_of(to_delayed_work(work), struct host1x_cdma, in cdma_timeout_handler()
244 host1x = cdma_to_host1x(cdma); in cdma_timeout_handler()
245 ch = cdma_to_channel(cdma); in cdma_timeout_handler()
247 host1x_debug_dump(cdma_to_host1x(cdma)); in cdma_timeout_handler()
249 mutex_lock(&cdma->lock); in cdma_timeout_handler()
251 if (!cdma->timeout.client) { in cdma_timeout_handler()
254 mutex_unlock(&cdma->lock); in cdma_timeout_handler()
266 syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt); in cdma_timeout_handler()
269 if ((s32)(syncpt_val - cdma->timeout.syncpt_val) >= 0) { in cdma_timeout_handler()
276 mutex_unlock(&cdma->lock); in cdma_timeout_handler()
281 __func__, cdma->timeout.syncpt->id, cdma->timeout.syncpt->name, in cdma_timeout_handler()
282 syncpt_val, cdma->timeout.syncpt_val); in cdma_timeout_handler()
285 host1x_hw_cdma_freeze(host1x, cdma); in cdma_timeout_handler()
287 host1x_cdma_update_sync_queue(cdma, ch->dev); in cdma_timeout_handler()
288 mutex_unlock(&cdma->lock); in cdma_timeout_handler()
294 static int cdma_timeout_init(struct host1x_cdma *cdma, u32 syncpt_id) in cdma_timeout_init() argument
296 INIT_DELAYED_WORK(&cdma->timeout.wq, cdma_timeout_handler); in cdma_timeout_init()
297 cdma->timeout.initialized = true; in cdma_timeout_init()
305 static void cdma_timeout_destroy(struct host1x_cdma *cdma) in cdma_timeout_destroy() argument
307 if (cdma->timeout.initialized) in cdma_timeout_destroy()
308 cancel_delayed_work(&cdma->timeout.wq); in cdma_timeout_destroy()
309 cdma->timeout.initialized = false; in cdma_timeout_destroy()