Lines Matching refs:cdma
50 struct host1x_cdma *cdma = pb_to_cdma(pb); in host1x_pushbuffer_destroy() local
51 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_pushbuffer_destroy()
72 struct host1x_cdma *cdma = pb_to_cdma(pb); in host1x_pushbuffer_init() local
73 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_pushbuffer_init()
185 unsigned int host1x_cdma_wait_locked(struct host1x_cdma *cdma, in host1x_cdma_wait_locked() argument
189 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_wait_locked()
194 space = list_empty(&cdma->sync_queue) ? 1 : 0; in host1x_cdma_wait_locked()
209 trace_host1x_wait_cdma(dev_name(cdma_to_channel(cdma)->dev), in host1x_cdma_wait_locked()
213 if (cdma->event != CDMA_EVENT_NONE) { in host1x_cdma_wait_locked()
214 mutex_unlock(&cdma->lock); in host1x_cdma_wait_locked()
216 mutex_lock(&cdma->lock); in host1x_cdma_wait_locked()
220 cdma->event = event; in host1x_cdma_wait_locked()
222 mutex_unlock(&cdma->lock); in host1x_cdma_wait_locked()
223 wait_for_completion(&cdma->complete); in host1x_cdma_wait_locked()
224 mutex_lock(&cdma->lock); in host1x_cdma_wait_locked()
236 struct host1x_cdma *cdma, in host1x_cdma_wait_pushbuffer_space() argument
240 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_wait_pushbuffer_space()
247 trace_host1x_wait_cdma(dev_name(cdma_to_channel(cdma)->dev), in host1x_cdma_wait_pushbuffer_space()
251 if (cdma->event != CDMA_EVENT_NONE) { in host1x_cdma_wait_pushbuffer_space()
252 mutex_unlock(&cdma->lock); in host1x_cdma_wait_pushbuffer_space()
254 mutex_lock(&cdma->lock); in host1x_cdma_wait_pushbuffer_space()
258 cdma->event = CDMA_EVENT_PUSH_BUFFER_SPACE; in host1x_cdma_wait_pushbuffer_space()
260 mutex_unlock(&cdma->lock); in host1x_cdma_wait_pushbuffer_space()
261 wait_for_completion(&cdma->complete); in host1x_cdma_wait_pushbuffer_space()
262 mutex_lock(&cdma->lock); in host1x_cdma_wait_pushbuffer_space()
271 static void cdma_start_timer_locked(struct host1x_cdma *cdma, in cdma_start_timer_locked() argument
274 if (cdma->timeout.client) { in cdma_start_timer_locked()
279 cdma->timeout.client = job->client; in cdma_start_timer_locked()
280 cdma->timeout.syncpt = job->syncpt; in cdma_start_timer_locked()
281 cdma->timeout.syncpt_val = job->syncpt_end; in cdma_start_timer_locked()
282 cdma->timeout.start_ktime = ktime_get(); in cdma_start_timer_locked()
284 schedule_delayed_work(&cdma->timeout.wq, in cdma_start_timer_locked()
292 static void stop_cdma_timer_locked(struct host1x_cdma *cdma) in stop_cdma_timer_locked() argument
294 cancel_delayed_work(&cdma->timeout.wq); in stop_cdma_timer_locked()
295 cdma->timeout.client = NULL; in stop_cdma_timer_locked()
308 static void update_cdma_locked(struct host1x_cdma *cdma) in update_cdma_locked() argument
317 list_for_each_entry_safe(job, n, &cdma->sync_queue, list) { in update_cdma_locked()
325 cdma_start_timer_locked(cdma, job); in update_cdma_locked()
331 if (cdma->timeout.client) in update_cdma_locked()
332 stop_cdma_timer_locked(cdma); in update_cdma_locked()
339 struct push_buffer *pb = &cdma->push_buffer; in update_cdma_locked()
343 if (cdma->event == CDMA_EVENT_PUSH_BUFFER_SPACE) in update_cdma_locked()
351 if (cdma->event == CDMA_EVENT_SYNC_QUEUE_EMPTY && in update_cdma_locked()
352 list_empty(&cdma->sync_queue)) in update_cdma_locked()
356 cdma->event = CDMA_EVENT_NONE; in update_cdma_locked()
357 complete(&cdma->complete); in update_cdma_locked()
361 void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma, in host1x_cdma_update_sync_queue() argument
364 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_update_sync_queue()
368 syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt); in host1x_cdma_update_sync_queue()
383 list_for_each_entry(job, &cdma->sync_queue, list) { in host1x_cdma_update_sync_queue()
386 if (!list_is_last(&job->list, &cdma->sync_queue)) in host1x_cdma_update_sync_queue()
409 restart_addr = cdma->last_pos; in host1x_cdma_update_sync_queue()
428 host1x_hw_cdma_timeout_cpu_incr(host1x, cdma, job->first_get, in host1x_cdma_update_sync_queue()
442 list_for_each_entry_continue(job, &cdma->sync_queue, list) { in host1x_cdma_update_sync_queue()
451 u32 *mapped = cdma->push_buffer.mapped; in host1x_cdma_update_sync_queue()
483 update_cdma_locked(cdma); in host1x_cdma_update_sync_queue()
488 host1x_hw_cdma_resume(host1x, cdma, restart_addr); in host1x_cdma_update_sync_queue()
493 struct host1x_cdma *cdma = container_of(work, struct host1x_cdma, update_work); in cdma_update_work() local
495 mutex_lock(&cdma->lock); in cdma_update_work()
496 update_cdma_locked(cdma); in cdma_update_work()
497 mutex_unlock(&cdma->lock); in cdma_update_work()
503 int host1x_cdma_init(struct host1x_cdma *cdma) in host1x_cdma_init() argument
507 mutex_init(&cdma->lock); in host1x_cdma_init()
508 init_completion(&cdma->complete); in host1x_cdma_init()
509 INIT_WORK(&cdma->update_work, cdma_update_work); in host1x_cdma_init()
511 INIT_LIST_HEAD(&cdma->sync_queue); in host1x_cdma_init()
513 cdma->event = CDMA_EVENT_NONE; in host1x_cdma_init()
514 cdma->running = false; in host1x_cdma_init()
515 cdma->torndown = false; in host1x_cdma_init()
517 err = host1x_pushbuffer_init(&cdma->push_buffer); in host1x_cdma_init()
527 int host1x_cdma_deinit(struct host1x_cdma *cdma) in host1x_cdma_deinit() argument
529 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_deinit()
530 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_deinit()
532 if (cdma->running) { in host1x_cdma_deinit()
538 host1x_hw_cdma_timeout_destroy(host1x, cdma); in host1x_cdma_deinit()
546 int host1x_cdma_begin(struct host1x_cdma *cdma, struct host1x_job *job) in host1x_cdma_begin() argument
548 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_begin()
550 mutex_lock(&cdma->lock); in host1x_cdma_begin()
558 mutex_unlock(&cdma->lock); in host1x_cdma_begin()
564 if (!cdma->timeout.initialized) { in host1x_cdma_begin()
567 err = host1x_hw_cdma_timeout_init(host1x, cdma); in host1x_cdma_begin()
569 mutex_unlock(&cdma->lock); in host1x_cdma_begin()
575 if (!cdma->running) in host1x_cdma_begin()
576 host1x_hw_cdma_start(host1x, cdma); in host1x_cdma_begin()
578 cdma->slots_free = 0; in host1x_cdma_begin()
579 cdma->slots_used = 0; in host1x_cdma_begin()
580 cdma->first_get = cdma->push_buffer.pos; in host1x_cdma_begin()
590 void host1x_cdma_push(struct host1x_cdma *cdma, u32 op1, u32 op2) in host1x_cdma_push() argument
592 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_push()
593 u32 slots_free = cdma->slots_free; in host1x_cdma_push()
596 trace_host1x_cdma_push(dev_name(cdma_to_channel(cdma)->dev), in host1x_cdma_push()
600 slots_free = host1x_cdma_wait_locked(cdma, in host1x_cdma_push()
603 cdma->slots_free = slots_free - 1; in host1x_cdma_push()
604 cdma->slots_used++; in host1x_cdma_push()
617 void host1x_cdma_push_wide(struct host1x_cdma *cdma, u32 op1, u32 op2, in host1x_cdma_push_wide() argument
620 struct host1x_channel *channel = cdma_to_channel(cdma); in host1x_cdma_push_wide()
621 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_push_wide()
622 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_push_wide()
635 host1x_cdma_wait_pushbuffer_space(host1x, cdma, needed); in host1x_cdma_push_wide()
638 cdma->slots_free = space - needed; in host1x_cdma_push_wide()
639 cdma->slots_used += needed; in host1x_cdma_push_wide()
660 void host1x_cdma_end(struct host1x_cdma *cdma, in host1x_cdma_end() argument
663 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_end()
664 bool idle = list_empty(&cdma->sync_queue); in host1x_cdma_end()
666 host1x_hw_cdma_flush(host1x, cdma); in host1x_cdma_end()
668 job->first_get = cdma->first_get; in host1x_cdma_end()
669 job->num_slots = cdma->slots_used; in host1x_cdma_end()
671 list_add_tail(&job->list, &cdma->sync_queue); in host1x_cdma_end()
675 cdma_start_timer_locked(cdma, job); in host1x_cdma_end()
678 mutex_unlock(&cdma->lock); in host1x_cdma_end()
684 void host1x_cdma_update(struct host1x_cdma *cdma) in host1x_cdma_update() argument
686 schedule_work(&cdma->update_work); in host1x_cdma_update()