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()
250 host1x_hw_cdma_flush(host1x, cdma); in host1x_cdma_wait_pushbuffer_space()
253 if (cdma->event != CDMA_EVENT_NONE) { in host1x_cdma_wait_pushbuffer_space()
254 mutex_unlock(&cdma->lock); in host1x_cdma_wait_pushbuffer_space()
256 mutex_lock(&cdma->lock); in host1x_cdma_wait_pushbuffer_space()
260 cdma->event = CDMA_EVENT_PUSH_BUFFER_SPACE; in host1x_cdma_wait_pushbuffer_space()
262 mutex_unlock(&cdma->lock); in host1x_cdma_wait_pushbuffer_space()
263 wait_for_completion(&cdma->complete); in host1x_cdma_wait_pushbuffer_space()
264 mutex_lock(&cdma->lock); in host1x_cdma_wait_pushbuffer_space()
273 static void cdma_start_timer_locked(struct host1x_cdma *cdma, in cdma_start_timer_locked() argument
276 if (cdma->timeout.client) { in cdma_start_timer_locked()
281 cdma->timeout.client = job->client; in cdma_start_timer_locked()
282 cdma->timeout.syncpt = job->syncpt; in cdma_start_timer_locked()
283 cdma->timeout.syncpt_val = job->syncpt_end; in cdma_start_timer_locked()
284 cdma->timeout.start_ktime = ktime_get(); in cdma_start_timer_locked()
286 schedule_delayed_work(&cdma->timeout.wq, in cdma_start_timer_locked()
294 static void stop_cdma_timer_locked(struct host1x_cdma *cdma) in stop_cdma_timer_locked() argument
296 cancel_delayed_work(&cdma->timeout.wq); in stop_cdma_timer_locked()
297 cdma->timeout.client = NULL; in stop_cdma_timer_locked()
310 static void update_cdma_locked(struct host1x_cdma *cdma) in update_cdma_locked() argument
319 list_for_each_entry_safe(job, n, &cdma->sync_queue, list) { in update_cdma_locked()
327 cdma_start_timer_locked(cdma, job); in update_cdma_locked()
333 if (cdma->timeout.client) in update_cdma_locked()
334 stop_cdma_timer_locked(cdma); in update_cdma_locked()
341 struct push_buffer *pb = &cdma->push_buffer; in update_cdma_locked()
345 if (cdma->event == CDMA_EVENT_PUSH_BUFFER_SPACE) in update_cdma_locked()
353 if (cdma->event == CDMA_EVENT_SYNC_QUEUE_EMPTY && in update_cdma_locked()
354 list_empty(&cdma->sync_queue)) in update_cdma_locked()
358 cdma->event = CDMA_EVENT_NONE; in update_cdma_locked()
359 complete(&cdma->complete); in update_cdma_locked()
363 void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma, in host1x_cdma_update_sync_queue() argument
366 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_update_sync_queue()
370 syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt); in host1x_cdma_update_sync_queue()
385 list_for_each_entry(job, &cdma->sync_queue, list) { in host1x_cdma_update_sync_queue()
388 if (!list_is_last(&job->list, &cdma->sync_queue)) in host1x_cdma_update_sync_queue()
411 restart_addr = cdma->last_pos; in host1x_cdma_update_sync_queue()
430 host1x_hw_cdma_timeout_cpu_incr(host1x, cdma, job->first_get, in host1x_cdma_update_sync_queue()
444 list_for_each_entry_continue(job, &cdma->sync_queue, list) { in host1x_cdma_update_sync_queue()
453 u32 *mapped = cdma->push_buffer.mapped; in host1x_cdma_update_sync_queue()
485 update_cdma_locked(cdma); in host1x_cdma_update_sync_queue()
490 host1x_hw_cdma_resume(host1x, cdma, restart_addr); in host1x_cdma_update_sync_queue()
495 struct host1x_cdma *cdma = container_of(work, struct host1x_cdma, update_work); in cdma_update_work() local
497 mutex_lock(&cdma->lock); in cdma_update_work()
498 update_cdma_locked(cdma); in cdma_update_work()
499 mutex_unlock(&cdma->lock); in cdma_update_work()
505 int host1x_cdma_init(struct host1x_cdma *cdma) in host1x_cdma_init() argument
509 mutex_init(&cdma->lock); in host1x_cdma_init()
510 init_completion(&cdma->complete); in host1x_cdma_init()
511 INIT_WORK(&cdma->update_work, cdma_update_work); in host1x_cdma_init()
513 INIT_LIST_HEAD(&cdma->sync_queue); in host1x_cdma_init()
515 cdma->event = CDMA_EVENT_NONE; in host1x_cdma_init()
516 cdma->running = false; in host1x_cdma_init()
517 cdma->torndown = false; in host1x_cdma_init()
519 err = host1x_pushbuffer_init(&cdma->push_buffer); in host1x_cdma_init()
529 int host1x_cdma_deinit(struct host1x_cdma *cdma) in host1x_cdma_deinit() argument
531 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_deinit()
532 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_deinit()
534 if (cdma->running) { in host1x_cdma_deinit()
540 host1x_hw_cdma_timeout_destroy(host1x, cdma); in host1x_cdma_deinit()
548 int host1x_cdma_begin(struct host1x_cdma *cdma, struct host1x_job *job) in host1x_cdma_begin() argument
550 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_begin()
552 mutex_lock(&cdma->lock); in host1x_cdma_begin()
560 mutex_unlock(&cdma->lock); in host1x_cdma_begin()
566 if (!cdma->timeout.initialized) { in host1x_cdma_begin()
569 err = host1x_hw_cdma_timeout_init(host1x, cdma); in host1x_cdma_begin()
571 mutex_unlock(&cdma->lock); in host1x_cdma_begin()
577 if (!cdma->running) in host1x_cdma_begin()
578 host1x_hw_cdma_start(host1x, cdma); in host1x_cdma_begin()
580 cdma->slots_free = 0; in host1x_cdma_begin()
581 cdma->slots_used = 0; in host1x_cdma_begin()
582 cdma->first_get = cdma->push_buffer.pos; in host1x_cdma_begin()
592 void host1x_cdma_push(struct host1x_cdma *cdma, u32 op1, u32 op2) in host1x_cdma_push() argument
594 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_push()
595 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_push()
596 u32 slots_free = cdma->slots_free; in host1x_cdma_push()
599 trace_host1x_cdma_push(dev_name(cdma_to_channel(cdma)->dev), in host1x_cdma_push()
603 host1x_hw_cdma_flush(host1x, cdma); in host1x_cdma_push()
604 slots_free = host1x_cdma_wait_locked(cdma, in host1x_cdma_push()
608 cdma->slots_free = slots_free - 1; in host1x_cdma_push()
609 cdma->slots_used++; in host1x_cdma_push()
622 void host1x_cdma_push_wide(struct host1x_cdma *cdma, u32 op1, u32 op2, in host1x_cdma_push_wide() argument
625 struct host1x_channel *channel = cdma_to_channel(cdma); in host1x_cdma_push_wide()
626 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_push_wide()
627 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_push_wide()
640 host1x_cdma_wait_pushbuffer_space(host1x, cdma, needed); in host1x_cdma_push_wide()
643 cdma->slots_free = space - needed; in host1x_cdma_push_wide()
644 cdma->slots_used += needed; in host1x_cdma_push_wide()
665 void host1x_cdma_end(struct host1x_cdma *cdma, in host1x_cdma_end() argument
668 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_end()
669 bool idle = list_empty(&cdma->sync_queue); in host1x_cdma_end()
671 host1x_hw_cdma_flush(host1x, cdma); in host1x_cdma_end()
673 job->first_get = cdma->first_get; in host1x_cdma_end()
674 job->num_slots = cdma->slots_used; in host1x_cdma_end()
676 list_add_tail(&job->list, &cdma->sync_queue); in host1x_cdma_end()
680 cdma_start_timer_locked(cdma, job); in host1x_cdma_end()
683 mutex_unlock(&cdma->lock); in host1x_cdma_end()
689 void host1x_cdma_update(struct host1x_cdma *cdma) in host1x_cdma_update() argument
691 schedule_work(&cdma->update_work); in host1x_cdma_update()